Does a HashMap with a getAndWait() method exist? E.g. a BlockingConcurrentHashMap implementation?

Viewed 7123

Many threads may populate a HashMap, in some cases I need to wait (block) until an object exists in the HashMap, such as:

BlockingConcurrentHashMap map = new BlockingConcurrentHashMap();
Object x = map.getAndWait(key, 1000);    //(object_to_get, max_delay_ms)

Wondering if such a thing exists already, I hate re-inventing wheels.

5 Answers
Related