added lock to support multiple jobqueues