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
Modifier and TypeFieldDescriptionprotected Collection
<V> The values collection.protected final boolean
Determines whether or not all of the Entry methods are protected; if set to true, then all Entry methods are protected.protected final ReadWriteLock
The read/write lock for concurrency control.protected final Lock
The exclusive lock for performing read/write operations.protected final Lock
The shared lock for performing read operations.The Map to which this wrapper delegates.The entry set.The key set. -
Constructor Summary
ModifierConstructorDescriptionprotected
ConcurrentWrapperMap
(Map<K, V> map) Create an ConcurrentWrapperMap which delegates to the specified Map.protected
ConcurrentWrapperMap
(Map<K, V> map, ReadWriteLock lock) Create an ConcurrentWrapperMap which delegates to the specified Map.protected
ConcurrentWrapperMap
(Map<K, V> map, ReadWriteLock lock, boolean fStrict) Create an ConcurrentWrapperMap which delegates to the specified Map. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
computeIfAbsent
(K key, Function<? super K, ? extends V> mappingFunction) computeIfPresent
(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) boolean
containsKey
(Object oKey) boolean
containsValue
(Object oValue) entrySet()
boolean
void
forEach
(BiConsumer<? super K, ? super V> action) Return the Map to which all operations should be delegated to.protected ReadWriteLock
getLock()
Return the ReadWriteLock that is used to manage concurrent access and modifications to the underlying map.getOrDefault
(Object key, V defaultValue) int
hashCode()
boolean
isEmpty()
keySet()
void
putIfAbsent
(K key, V value) boolean
boolean
void
replaceAll
(BiFunction<? super K, ? super V, ? extends V> function) int
size()
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:
containsKey
in interfaceMap<K,
V>
-
containsValue
- Specified by:
containsValue
in interfaceMap<K,
V>
-
entrySet
-
get
-
isEmpty
public boolean isEmpty() -
keySet
-
put
-
putAll
-
putIfAbsent
- Specified by:
putIfAbsent
in interfaceConcurrentMap<K,
V> - Specified by:
putIfAbsent
in interfaceMap<K,
V>
-
remove
-
remove
-
replace
-
replace
-
size
public int size() -
values
-
getOrDefault
- Specified by:
getOrDefault
in interfaceConcurrentMap<K,
V> - Specified by:
getOrDefault
in interfaceMap<K,
V>
-
forEach
-
replaceAll
- Specified by:
replaceAll
in interfaceConcurrentMap<K,
V> - Specified by:
replaceAll
in interfaceMap<K,
V>
-
computeIfAbsent
- Specified by:
computeIfAbsent
in interfaceConcurrentMap<K,
V> - Specified by:
computeIfAbsent
in interfaceMap<K,
V>
-
computeIfPresent
- Specified by:
computeIfPresent
in interfaceConcurrentMap<K,
V> - Specified by:
computeIfPresent
in interfaceMap<K,
V>
-
compute
-
merge
-
equals
-
hashCode
public int hashCode() -
toString
-