public static class ConverterCollections.ConverterConcurrentMap<FK,TK,FV,TV> extends ConverterCollections.ConverterMap<FK,TK,FV,TV> implements ConcurrentMap<TK,TV>, Serializable
m_convKeyDown, m_convKeyUp, m_convValDown, m_convValUp, m_map, m_set
LOCK_ALL
Constructor and Description |
---|
ConverterConcurrentMap(ConcurrentMap<FK,FV> map,
Converter<FK,TK> convKeyUp,
Converter<TK,FK> convKeyDown,
Converter<FV,TV> convValUp,
Converter<TV,FV> convValDown)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
ConcurrentMap<FK,FV> |
getConcurrentMap()
Return the underlying ConcurrentMap.
|
boolean |
lock(Object oKey)
Attempt to lock the specified item and return immediately.
|
boolean |
lock(Object oKey,
long cWait)
Attempt to lock the specified item within the specified period of time.
|
boolean |
unlock(Object oKey)
Unlock the specified item.
|
clear, containsKey, containsValue, entrySet, equals, get, getConverterKeyDown, getConverterKeyUp, getConverterValueDown, getConverterValueUp, getMap, hashCode, instantiateCollection, instantiateEntrySet, instantiateMap, instantiateSet, isEmpty, keySet, put, putAll, remove, size, toString, values
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
clear, containsKey, containsValue, get, isEmpty, put, putAll, remove, size
compute, computeIfAbsent, computeIfPresent, entrySet, equals, forEach, getOrDefault, hashCode, keySet, merge, putIfAbsent, remove, replace, replace, replaceAll, values
public ConverterConcurrentMap(ConcurrentMap<FK,FV> map, Converter<FK,TK> convKeyUp, Converter<TK,FK> convKeyDown, Converter<FV,TV> convValUp, Converter<TV,FV> convValDown)
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 ConcurrentMappublic boolean lock(Object oKey)
This method behaves exactly as if it simply performs the call lock(oKey, 0).
lock
in interface ConcurrentMap<TK,TV>
oKey
- key being lockedpublic boolean lock(Object oKey, long cWait)
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.
lock
in interface ConcurrentMap<TK,TV>
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 obtainedpublic boolean unlock(Object oKey)
unlock
in interface ConcurrentMap<TK,TV>
oKey
- key being unlockedpublic ConcurrentMap<FK,FV> getConcurrentMap()