public class SizeAwaitMap<K,V> extends Object implements Map<K,V>
| Modifier and Type | Class and Description |
|---|---|
static interface |
SizeAwaitMap.Predicate<V>
Specifies which values should be counted.
|
| Constructor and Description |
|---|
SizeAwaitMap(EnvironmentImpl envImpl,
SizeAwaitMap.Predicate<V> predicate)
Creates an instance of this class.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Deprecated.
Use
clear(Exception) instead. |
void |
clear(Exception cause)
Clears the underlying map and the latch map, after first counting them
down, thus permitting any waiting threads to make progress.
|
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
Set<Map.Entry<K,V>> |
entrySet()
The caller should synchronize on the map while accessing the return
value.
|
V |
get(Object key) |
StatGroup |
getStatistics() |
boolean |
isEmpty() |
Set<K> |
keySet()
The caller should synchronize on the map while accessing the return
value.
|
V |
put(K key,
V value)
Notes the addition of a new value and counts down any latches that were
assigned to that threshold.
|
void |
putAll(Map<? extends K,? extends V> t) |
V |
remove(Object key) |
int |
size() |
boolean |
sizeAwait(int thresholdSize,
long timeout,
TimeUnit unit)
Causes the requesting thread to wait until the map reaches the specified
size or the thread is interrupted.
|
Collection<V> |
values()
The caller should synchronize on the map while accessing the return
value.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcompute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAllpublic SizeAwaitMap(EnvironmentImpl envImpl, SizeAwaitMap.Predicate<V> predicate)
envImpl - the environment, used for exception handlingpredicate - the predicate for counting matching entries, or
null to match all entriespublic StatGroup getStatistics()
public boolean sizeAwait(int thresholdSize,
long timeout,
TimeUnit unit)
throws InterruptedException
thresholdSize - the size to wait for.InterruptedException - for the usual reasons, or if the map
was cleared and the size threshold was not actually reached.public V put(K key, V value)
@Deprecated public void clear() throws UnsupportedOperationException
clear(Exception) instead.clear in interface Map<K,V>UnsupportedOperationExceptionpublic void clear(Exception cause)
cause - the value is non-null if the map is being cleared in
response to an exception and results in the exception being thrown in
the waiting threads. It's null if the map is being cleared as part of a
normal shutdown, in which case no exception is thrown.public boolean containsKey(Object key)
containsKey in interface Map<K,V>public boolean containsValue(Object value)
containsValue in interface Map<K,V>public Set<Map.Entry<K,V>> entrySet()
public Set<K> keySet()
Copyright © 2024. All rights reserved.