lock job_list before data transfer

This is the equivalent of your pull request. I put some codes in functions.

1. The data down load code is protected by try so the lock release is never missed.
2. The lock acquire and release are not too far from each other. 
3. Removed some hardcoded rabbitMQ addresses.