328329330331332333334335336337338
worker.setLock(lock); worker.setWorkId(workId); while (!lock.addWork(workId, worker)) { try { // wait on the lock. lock.awaitRemoval(workId); } catch (InterruptedException e) { e.printStackTrace(); } }