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
Premature optimization is the root of evil
Try it with a (synchronized) map.
Maybe if it grows too big, you can clear its content at regular intervals.