[JobQueue] Added support for using an external DB.

* Added a new ScopedCallback class to handle reuseConnection() easily.

Change-Id: Icfab280f0173c2cb1ac44cc0bd45e9202600687b