Use a CountDownLatch to wait for the  job to complete instead of Thread.sleep()