Package ca.uhn.hl7v2.concurrent
Interface BlockingMap<K,V>
- All Superinterfaces:
Map<K,V>
- All Known Implementing Classes:
BlockingHashMap
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionPolls for an entry in a background thread.Waits for an entry in a background thread.booleanAdds an entry only if there's already a consumer waiting for the value.Waits for the specified amount of time for an entry with the given key and returns the associated value.Waits for an entry for the given key and returns the associated value.Methods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
Method Details
-
give
Adds an entry only if there's already a consumer waiting for the value.- Parameters:
key- key for the entry to be addedvalue- entry to be added- Returns:
- true if entry was added and a consumer is already waiting for the value, false otherwise
-
take
Waits for an entry for the given key and returns the associated value. May return null if the producer withdraws the entry without providing a value.- Parameters:
key- key for the entry- Returns:
- the value of the entry
- Throws:
InterruptedException
-
asyncTake
Waits for an entry in a background thread.- Parameters:
key- key for the entry- Returns:
- Future the result
-
poll
Waits for the specified amount of time for an entry with the given key and returns the associated value. Returns null if no value was provided within the poll time. May return null if the producer withdraws the entry without providing a value.- Parameters:
key- key for the entrytimeout- timeout before the methods returnsunit- time unit used in conjunction with timout- Returns:
- the value of the entry
- Throws:
InterruptedException
-
asyncPoll
Polls for an entry in a background thread.- Parameters:
key- key for the entry- Returns:
- Future the result
-