|
Oracle® Fusion Middleware Java API Reference for Oracle Coherence 12c (12.1.3.0.0) E47890-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ConcurrentMap
Map with additional concurrency features.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface java.util.Map |
---|
java.util.Map.Entry |
Field Summary | |
---|---|
static java.lang.Object |
LOCK_ALL Special key value indicating an intent to lock the entire map. |
Method Summary | |
---|---|
void |
clear() Removes all mappings from this map. |
boolean |
containsKey(java.lang.Object key) Returns true if this map contains a mapping for the specified key. |
boolean |
containsValue(java.lang.Object value) Returns true if this map maps one or more keys to the specified value. |
java.lang.Object |
get(java.lang.Object key) Returns the value to which this map maps the specified key. |
boolean |
isEmpty() Returns true if this map contains no key-value mappings. |
boolean |
lock(java.lang.Object oKey) Attempt to lock the specified item and return immediately. |
boolean |
lock(java.lang.Object oKey, long cWait) Attempt to lock the specified item within the specified period of time. |
java.lang.Object |
put(java.lang.Object key, java.lang.Object value) Associates the specified value with the specified key in this map (optional operation). |
void |
putAll(java.util.Map map) Copies all of the mappings from the specified map to this map (optional operation). |
java.lang.Object |
remove(java.lang.Object key) Removes the mapping for this key from this map if present (optional operation). |
int |
size() Returns the number of key-value mappings in this map. |
boolean |
unlock(java.lang.Object oKey) Unlock the specified item. |
Methods inherited from interface java.util.Map |
---|
entrySet, equals, hashCode, keySet, values |
Field Detail |
---|
static final java.lang.Object LOCK_ALL
Method Detail |
---|
boolean lock(java.lang.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 LOCK_ALL
as the oKey parameter to indicate the map lock.
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 obtainedboolean lock(java.lang.Object oKey)
This method behaves exactly as if it simply performs the call lock(oKey, 0).
oKey
- key being lockedboolean unlock(java.lang.Object oKey)
oKey
- key being unlockedint size()
size
in interface java.util.Map
boolean isEmpty()
isEmpty
in interface java.util.Map
boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map
key
- key whose presence in this map is to be testedjava.lang.ClassCastException
- if the key is of an inappropriate type for this mapjava.lang.NullPointerException
- if the key is null and this map does not not permit null keysboolean containsValue(java.lang.Object value)
containsValue
in interface java.util.Map
value
- value whose presence in this map is to be testedjava.lang.Object get(java.lang.Object key)
get
in interface java.util.Map
key
- key whose associated value is to be returnedjava.lang.ClassCastException
- if the key is of an inappropriate type for this mapjava.lang.NullPointerException
- key is null and this map does not not permit null keyscontainsKey(Object)
java.lang.Object put(java.lang.Object key, java.lang.Object value)
Some implementations will attempt to obtain a lock for the key (if necessary) before proceeding with the put operation. For such implementations, the specified item has to be either already locked or able to be locked for this operation to succeed.
put
in interface java.util.Map
key
- key with which the specified value is to be associatedvalue
- value to be associated with the specified keyjava.lang.IllegalArgumentException
- if the value cannot be stored in the map (i.e. not serializable)java.util.ConcurrentModificationException
- if the lock could not be successfully obtained for the specified keyjava.lang.ClassCastException
- if the class of the specified key or value prevents it from being stored in this mapjava.lang.NullPointerException
- this map does not permit null keys or values, and the specified key or value is nulljava.lang.Object remove(java.lang.Object key)
Some implementations will attempt to obtain a lock for the key (if necessary) before proceeding with the remove operation. For such implementations, the specified item has to be either already locked or able to be locked for this operation to succeed.
remove
in interface java.util.Map
key
- key whose mapping is to be removed from the mapjava.util.ConcurrentModificationException
- if the lock could not be successfully obtained for the specified keyvoid putAll(java.util.Map map)
putAll
in interface java.util.Map
map
- Mappings to be stored in this mapjava.lang.ClassCastException
- if the class of a key or value in the specified map prevents it from being stored in this mapjava.util.ConcurrentModificationException
- if the lock could not be successfully obtained for some keyjava.lang.NullPointerException
- this map does not permit null keys or values, and the specified key or value is nullvoid clear()
Some implementations will attempt to lock the entire map (if necessary) before proceeding with the clear operation. For such implementations, the entire map has to be either already locked or able to be locked for this operation to succeed.
clear
in interface java.util.Map
java.util.ConcurrentModificationException
- if a lock could not be successfully obtained for some key
|
Oracle® Fusion Middleware Java API Reference for Oracle Coherence 12c (12.1.3.0.0) E47890-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |