|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.sleepycat.je.rep.utilint.SizeAwaitMap<K,V>
public class SizeAwaitMap<K,V>
Creates a Map, that Threads can conveniently wait on to reach a specific size. The wait functionality is provided by the sizeAwait() method defined by this class.
| Nested Class Summary | |
|---|---|
(package private) class |
SizeAwaitMap.ThresholdLatch
Subtype to keep track of how the latch was cleared. |
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
Map.Entry<K,V> |
| Constructor Summary | |
|---|---|
SizeAwaitMap(Map<K,V> map)
Creates the wrapped Map class. |
|
| Method Summary | |
|---|---|
void |
clear()
Clears the underlying map and the latch map, after first counting them down, thus permitting them to make progress. |
boolean |
containsKey(Object key)
|
boolean |
containsValue(Object value)
|
Set<Map.Entry<K,V>> |
entrySet()
|
V |
get(Object key)
|
StatGroup |
getStatistics()
|
boolean |
isEmpty()
|
Set<K> |
keySet()
|
(package private) int |
latchCount()
Used for unit tests only |
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)
It's synchronized so that size() has a stable value in the above methods. |
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()
|
| 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 SizeAwaitMap(Map<K,V> map)
map - the actual map instance.| Method Detail |
|---|
public 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.int latchCount()
public V put(K key,
V value)
put in interface Map<K,V>public V remove(Object key)
remove in interface Map<K,V>public void clear()
clear in interface Map<K,V>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()
entrySet in interface Map<K,V>public V get(Object key)
get in interface Map<K,V>public boolean isEmpty()
isEmpty in interface Map<K,V>public Set<K> keySet()
keySet in interface Map<K,V>public void putAll(Map<? extends K,? extends V> t)
putAll in interface Map<K,V>public int size()
size in interface Map<K,V>public Collection<V> values()
values in interface Map<K,V>
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||