Package mondrian.util
Class BlockingHashMap<K,V>
java.lang.Object
mondrian.util.BlockingHashMap<K,V>
- Type Parameters:
K
- request (key) typeV
- response (value) type
A limited Map implementation which supports waiting for a value
to be available when calling get(). Intended for use with
producer/consumer queues, where a producer thread puts a value into
the collection with a separate thread waiting to get that value.
Currently used by the Actor implementations in
SegmentCacheManager
and MonitorImpl
.
Thread safety. BlockingHashMap is thread safe. The class delegates all get and put operations to a ConcurrentHashMap.
-
Constructor Summary
ConstructorDescriptionBlockingHashMap
(int capacity) Creates a BlockingHashMap with given capacity. -
Method Summary
-
Constructor Details
-
BlockingHashMap
public BlockingHashMap(int capacity) Creates a BlockingHashMap with given capacity.- Parameters:
capacity
- Capacity
-
-
Method Details
-
put
Places a (request, response) pair onto the map.- Parameters:
k
- keyv
- value
-
get
Retrieves the response from the map matching the given key, blocking until it is received.- Parameters:
k
- key- Returns:
- value
- Throws:
InterruptedException
- if interrupted while waiting
-