Package com.tangosol.util
Class WrapperCollections.ConcurrentWrapperMap<K,V>
java.lang.Object
com.tangosol.util.WrapperCollections.ConcurrentWrapperMap<K,V>
- All Implemented Interfaces:
ConcurrentMap<K,,V> Map<K,V>
- Enclosing class:
- WrapperCollections
public static class WrapperCollections.ConcurrentWrapperMap<K,V>
extends Object
implements ConcurrentMap<K,V>
Map implementation which uses a ReadWriteLock to manage concurrent
access to an underlying Map.
- Since:
- Coherence 3.7
-
Nested Class Summary
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Collection<V>The values collection.protected final booleanDetermines whether or not all of the Entry methods are protected; if set to true, then all Entry methods are protected.protected final ReadWriteLockThe read/write lock for concurrency control.protected final LockThe exclusive lock for performing read/write operations.protected final LockThe shared lock for performing read operations.The Map to which this wrapper delegates.The entry set.The key set. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConcurrentWrapperMap(Map<K, V> map) Create an ConcurrentWrapperMap which delegates to the specified Map.protectedConcurrentWrapperMap(Map<K, V> map, ReadWriteLock lock) Create an ConcurrentWrapperMap which delegates to the specified Map.protectedConcurrentWrapperMap(Map<K, V> map, ReadWriteLock lock, boolean fStrict) Create an ConcurrentWrapperMap which delegates to the specified Map. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction) computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) booleancontainsKey(Object oKey) booleancontainsValue(Object oValue) entrySet()booleanvoidforEach(BiConsumer<? super K, ? super V> action) Return the Map to which all operations should be delegated to.protected ReadWriteLockgetLock()Return the ReadWriteLock that is used to manage concurrent access and modifications to the underlying map.getOrDefault(Object key, V defaultValue) inthashCode()booleanisEmpty()keySet()voidputIfAbsent(K key, V value) booleanbooleanvoidreplaceAll(BiFunction<? super K, ? super V, ? extends V> function) intsize()toString()values()
-
Field Details
-
m_mapDelegate
The Map to which this wrapper delegates. -
m_lock
The read/write lock for concurrency control. -
m_lockExclusive
The exclusive lock for performing read/write operations. -
m_setKeys
The key set. -
m_setEntries
The entry set. -
m_collValues
The values collection. -
m_fStrict
protected final boolean m_fStrictDetermines whether or not all of the Entry methods are protected; if set to true, then all Entry methods are protected.
-
-
Constructor Details
-
ConcurrentWrapperMap
protected ConcurrentWrapperMap() -
ConcurrentWrapperMap
Create an ConcurrentWrapperMap which delegates to the specified Map.- Parameters:
map- the Map to delegate all calls to
-
ConcurrentWrapperMap
Create an ConcurrentWrapperMap which delegates to the specified Map.- Parameters:
map- the Map to delegate all calls tolock- a read/write lock for concurrency management
-
ConcurrentWrapperMap
Create an ConcurrentWrapperMap which delegates to the specified Map.- Parameters:
map- the Map to delegate all calls tolock- a read/write lock for concurrency managementfStrict- pass true to protect all Entry methods; false to protect only the setValue() method
-
-
Method Details
-
getDelegate
Return the Map to which all operations should be delegated to.- Returns:
- the wrapped Map
-
getLock
Return the ReadWriteLock that is used to manage concurrent access and modifications to the underlying map.- Returns:
- the ReadWriteLock
-
clear
public void clear() -
containsKey
- Specified by:
containsKeyin interfaceMap<K,V>
-
containsValue
- Specified by:
containsValuein interfaceMap<K,V>
-
entrySet
-
get
-
isEmpty
public boolean isEmpty() -
keySet
-
put
-
putAll
-
putIfAbsent
- Specified by:
putIfAbsentin interfaceConcurrentMap<K,V> - Specified by:
putIfAbsentin interfaceMap<K,V>
-
remove
-
remove
-
replace
-
replace
-
size
public int size() -
values
-
getOrDefault
- Specified by:
getOrDefaultin interfaceConcurrentMap<K,V> - Specified by:
getOrDefaultin interfaceMap<K,V>
-
forEach
-
replaceAll
- Specified by:
replaceAllin interfaceConcurrentMap<K,V> - Specified by:
replaceAllin interfaceMap<K,V>
-
computeIfAbsent
- Specified by:
computeIfAbsentin interfaceConcurrentMap<K,V> - Specified by:
computeIfAbsentin interfaceMap<K,V>
-
computeIfPresent
- Specified by:
computeIfPresentin interfaceConcurrentMap<K,V> - Specified by:
computeIfPresentin interfaceMap<K,V>
-
compute
-
merge
-
equals
-
hashCode
public int hashCode() -
toString
-