In our system, we have a method that will do some work when it\'s called with a certain ID:
public void doWork(long id) { /* ... */ }
Now, this
You can try something with a ReentrantLock, such that you have a Map. Now after lock.release() You can test lock.hasQueuedThreads(). If that returns false you can remove it from the Map.
Map