|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.sourceforge.jemm.util.managed.EnhancedConcurrentHashMap<K,V>
K - The key type.V - The value typepublic class EnhancedConcurrentHashMap<K,V>
EnhancedConcurrentHashMap is similar to ConcurrentHashMap, but adds some extra features. The main extra method is 'perform' that allows an arbitrary action to be performed whilst the lock on the given key is held (even if there is no entry in the map beforehand. N.B This map does not support null values, if put(key,null) is used, contains(key) will return false.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
java.util.Map.Entry<K,V> |
| Field Summary | |
|---|---|
static int |
DEFAULT_NO_BUCKETS
The default number of locking buckets. |
| Constructor Summary | |
|---|---|
|
EnhancedConcurrentHashMap()
Creates an EnhancedConcurrentHashMap with a default number of buckets. |
protected |
EnhancedConcurrentHashMap(ECMapBucketFactory<K,V> bucketFactory,
int noBuckets)
|
|
EnhancedConcurrentHashMap(int noBuckets)
Creates an EnhancedConcurrentHashMap with the given number of internal buckets. |
| Method Summary | |
|---|---|
void |
clear()
Clear all the entries in this map. |
boolean |
containsKey(java.lang.Object key)
|
boolean |
containsValue(java.lang.Object value)
|
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet()
|
V |
get(java.lang.Object key)
|
boolean |
isEmpty()
|
java.util.Set<K> |
keySet()
|
void |
perform(K key,
ECMAction<K,V> action)
Perform the given action whilst holding the lock on the given key. |
V |
put(K key,
V value)
|
void |
putAll(java.util.Map<? extends K,? extends V> m)
|
V |
putIfAbsent(K key,
V value)
Atomically associate a value with a key, if a value is not already assocated with the given key. |
V |
remove(java.lang.Object key)
|
boolean |
remove(java.lang.Object key,
java.lang.Object value)
|
V |
replace(K key,
V value)
|
boolean |
replace(K key,
V oldValue,
V newValue)
|
int |
size()
|
java.util.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 |
| Field Detail |
|---|
public static final int DEFAULT_NO_BUCKETS
| Constructor Detail |
|---|
public EnhancedConcurrentHashMap()
public EnhancedConcurrentHashMap(int noBuckets)
noBuckets -
protected EnhancedConcurrentHashMap(ECMapBucketFactory<K,V> bucketFactory,
int noBuckets)
| Method Detail |
|---|
public void perform(K key,
ECMAction<K,V> action)
perform in interface EnhancedConcurrentMap<K,V>key - The key to lock during the action.action - The action to perform whilst the lock is held.
public V putIfAbsent(K key,
V value)
putIfAbsent in interface java.util.concurrent.ConcurrentMap<K,V>key - The keyvalue - The new value to associate.
ConcurrentHashMap.putIfAbsent(Object,Object)
public boolean remove(java.lang.Object key,
java.lang.Object value)
remove in interface java.util.concurrent.ConcurrentMap<K,V>
public V replace(K key,
V value)
replace in interface java.util.concurrent.ConcurrentMap<K,V>
public boolean replace(K key,
V oldValue,
V newValue)
replace in interface java.util.concurrent.ConcurrentMap<K,V>public void clear()
clear in interface java.util.Map<K,V>Map.clear()public boolean containsKey(java.lang.Object key)
containsKey in interface java.util.Map<K,V>public boolean containsValue(java.lang.Object value)
containsValue in interface java.util.Map<K,V>public java.util.Set<java.util.Map.Entry<K,V>> entrySet()
entrySet in interface java.util.Map<K,V>public V get(java.lang.Object key)
get in interface java.util.Map<K,V>public boolean isEmpty()
isEmpty in interface java.util.Map<K,V>public java.util.Set<K> keySet()
keySet in interface java.util.Map<K,V>
public V put(K key,
V value)
put in interface java.util.Map<K,V>public void putAll(java.util.Map<? extends K,? extends V> m)
putAll in interface java.util.Map<K,V>public V remove(java.lang.Object key)
remove in interface java.util.Map<K,V>public int size()
size in interface java.util.Map<K,V>public java.util.Collection<V> values()
values in interface java.util.Map<K,V>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||