|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectca.uhn.hl7v2.concurrent.BlockingHashMap<K,V>
K - V - public class BlockingHashMap<K,V>
Default Implementation of a BlockingMap.
Note: While it is not actively prevented that more then one thread waits for an entry, it is not guaranteed that all waiting threads will receive the entry once it became available. Other implementations may choose to count the waiting threads and/or to remove an available value after a grace period.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
Map.Entry<K,V> |
| Constructor Summary | |
|---|---|
BlockingHashMap()
|
|
BlockingHashMap(ExecutorService executor)
|
|
| Method Summary | |
|---|---|
Future<V> |
asyncPoll(K key,
long timeout,
TimeUnit unit)
Polls for an entry in a background thread. |
Future<V> |
asyncTake(K key)
Waits for an entry in a background thread. |
void |
clear()
Clears all existing entries. |
boolean |
containsKey(Object key)
Returns true if an entry with the given key is available |
boolean |
containsValue(Object value)
|
Set<Map.Entry<K,V>> |
entrySet()
|
V |
get(Object key)
Returns an available entry without removing it from the map |
boolean |
give(K key,
V value)
Adds an entry only if there's already a consumer waiting for the value. |
boolean |
isEmpty()
Returns true if no entry is available for consumers |
Set<K> |
keySet()
Returns the keys of available entries |
V |
poll(K key,
long timeout,
TimeUnit unit)
Waits for the specified amount of time for an entry with the given key and returns the associated value. |
V |
put(K key,
V value)
|
void |
putAll(Map<? extends K,? extends V> t)
|
V |
remove(Object key)
Removes an entry, regardless whether a value has been set or not. |
int |
size()
Returns the number of available values |
V |
take(K key)
Waits for an entry for the given key and returns the associated value. |
Collection<V> |
values()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.Map |
|---|
equals, hashCode |
| Constructor Detail |
|---|
public BlockingHashMap()
public BlockingHashMap(ExecutorService executor)
| Method Detail |
|---|
public Set<K> keySet()
keySet in interface Map<K,V>Map.keySet()public V get(Object key)
get in interface Map<K,V>Map.get(java.lang.Object)public boolean containsKey(Object key)
true if an entry with the given key is available
containsKey in interface Map<K,V>Map.containsKey(java.lang.Object)
public V put(K key,
V value)
put in interface Map<K,V>Map.put(java.lang.Object, java.lang.Object)
public boolean give(K key,
V value)
BlockingMap
give in interface BlockingMap<K,V>BlockingMap.give(java.lang.Object,
java.lang.Object)
public V take(K key)
throws InterruptedException
BlockingMap
take in interface BlockingMap<K,V>InterruptedException
public Future<V> asyncTake(K key)
throws InterruptedException
BlockingMap
asyncTake in interface BlockingMap<K,V>InterruptedException
public V poll(K key,
long timeout,
TimeUnit unit)
throws InterruptedException
BlockingMap
poll in interface BlockingMap<K,V>InterruptedException
public Future<V> asyncPoll(K key,
long timeout,
TimeUnit unit)
BlockingMap
asyncPoll in interface BlockingMap<K,V>public boolean isEmpty()
isEmpty in interface Map<K,V>Map.isEmpty()public int size()
size in interface Map<K,V>Map.size()public V remove(Object key)
remove in interface Map<K,V>Map.remove(java.lang.Object)public void clear()
clear in interface Map<K,V>Map.clear()public Collection<V> values()
values in interface Map<K,V>public Set<Map.Entry<K,V>> entrySet()
entrySet in interface Map<K,V>public void putAll(Map<? extends K,? extends V> t)
putAll in interface Map<K,V>public boolean containsValue(Object value)
containsValue in interface Map<K,V>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||