Class ConverterCollections.ConverterConcurrentMap<FK,TK,FV,TV>
- All Implemented Interfaces:
ConcurrentMap<TK,
,TV> Serializable
,Map<TK,
TV>
- Enclosing class:
ConverterCollections
- See Also:
-
Nested Class Summary
-
Field Summary
Fields inherited from class com.tangosol.util.ConverterCollections.ConverterMap
m_convKeyDown, m_convKeyUp, m_convValDown, m_convValUp, m_map, m_set
Fields inherited from interface com.tangosol.util.ConcurrentMap
LOCK_ALL
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturn the underlying ConcurrentMap.boolean
Attempt to lock the specified item and return immediately.boolean
Attempt to lock the specified item within the specified period of time.boolean
Unlock the specified item.Methods inherited from class com.tangosol.util.ConverterCollections.ConverterMap
clear, containsKey, containsValue, entrySet, equals, get, getConverterKeyDown, getConverterKeyUp, getConverterValueDown, getConverterValueUp, getMap, hashCode, instantiateCollection, instantiateEntrySet, instantiateMap, instantiateSet, isEmpty, keySet, put, putAll, remove, size, subMap, toString, values
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.tangosol.util.ConcurrentMap
clear, containsKey, containsValue, get, isEmpty, put, putAll, remove, size
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, entrySet, equals, forEach, getOrDefault, hashCode, keySet, merge, putIfAbsent, remove, replace, replace, replaceAll, values
-
Constructor Details
-
ConverterConcurrentMap
public ConverterConcurrentMap(ConcurrentMap<FK, FV> map, Converter<FK, TK> convKeyUp, Converter<TK, FK> convKeyDown, Converter<FV, TV> convValUp, Converter<TV, FV> convValDown) Constructor.- Parameters:
map
- the underlying ConcurrentMapconvKeyUp
- the Converter to view the underlying ConcurrentMap's keys throughconvKeyDown
- the Converter to use to pass keys down to the underlying ConcurrentMapconvValUp
- the Converter to view the underlying ConcurrentMap's values throughconvValDown
- the Converter to use to pass values down to the underlying ConcurrentMap
-
-
Method Details
-
lock
Attempt to lock the specified item and return immediately.This method behaves exactly as if it simply performs the call lock(oKey, 0).
- Specified by:
lock
in interfaceConcurrentMap<FK,
TK> - Parameters:
oKey
- key being locked- Returns:
- true if the item was successfully locked; false otherwise
-
lock
Attempt to lock the specified item within the specified period of time.The item doesn't have to exist to be locked. While the item is locked there is known to be a lock holder which has an exclusive right to modify (calling put and remove methods) that item.
Lock holder is an abstract concept that depends on the ConcurrentMap implementation. For example, holder could be a cluster member or a thread (or both).
Locking strategy may vary for concrete implementations as well. Lock could have an expiration time (this lock is sometimes called a "lease") or be held indefinitely (until the lock holder terminates).
Some implementations may allow the entire map to be locked. If the map is locked in such a way, then only a lock holder is allowed to perform any of the "put" or "remove" operations. Pass the special constant
ConcurrentMap.LOCK_ALL
as the oKey parameter to indicate the map lock.- Specified by:
lock
in interfaceConcurrentMap<FK,
TK> - Parameters:
oKey
- key being lockedcWait
- the number of milliseconds to continue trying to obtain a lock; pass zero to return immediately; pass -1 to block the calling thread until the lock could be obtained- Returns:
- true if the item was successfully locked within the specified time; false otherwise
-
unlock
Unlock the specified item. The item doesn't have to exist to be unlocked. If the item is currently locked, only the holder of the lock could successfully unlock it.- Specified by:
unlock
in interfaceConcurrentMap<FK,
TK> - Parameters:
oKey
- key being unlocked- Returns:
- true if the item was successfully unlocked; false otherwise
-
getConcurrentMap
Return the underlying ConcurrentMap.- Returns:
- the underlying ConcurrentMap
-