|
Oracle® Coherence Java API Reference Release 3.6.1.0 E18814-01 |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object
com.tangosol.util.Base
com.tangosol.util.SegmentedHashMap
com.tangosol.util.SegmentedConcurrentMap
public class SegmentedConcurrentMap
An implementation of SegmentedHashMap that also implements the ConcurrentMap interface.
SeeConcurrentMap
| Nested Class Summary | |
|---|---|
protected class |
SegmentedConcurrentMap.LockableEntryLockableEntry is an Entry that supports locking. |
protected class |
SegmentedConcurrentMap.LockActionAction support for lock(). |
protected class |
SegmentedConcurrentMap.RemoveActionAction support for remove(). |
protected static class |
SegmentedConcurrentMap.SizeActionAction support for size(). |
protected class |
SegmentedConcurrentMap.UnlockActionAction support for unlock(). |
| Nested classes/interfaces inherited from class com.tangosol.util.SegmentedHashMap |
|---|
SegmentedHashMap.ContainsValueAction, SegmentedHashMap.Entry, SegmentedHashMap.EntryAction, SegmentedHashMap.EntryActionAdapter, SegmentedHashMap.EntrySet, SegmentedHashMap.GetEntryAction, SegmentedHashMap.InsertAction, SegmentedHashMap.IterableEntryAction, SegmentedHashMap.KeySet, SegmentedHashMap.Segment, SegmentedHashMap.ValuesCollection |
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
java.util.Map.Entry |
| Field Summary | |
|---|---|
protected SegmentedConcurrentMap.LockAction |
m_actionLockThe action for lock() support. |
protected SegmentedConcurrentMap.SizeAction |
m_actionSizeThe singleton action for size support. |
protected SegmentedConcurrentMap.UnlockAction |
m_actionUnlockThe action for unlock() support. |
protected ThreadGate |
m_gateLockAllThe ThreadGate controlling LOCK_ALL access for this map. |
| Fields inherited from interface com.tangosol.util.ConcurrentMap |
|---|
LOCK_ALL |
| Constructor Summary | |
|---|---|
SegmentedConcurrentMap()Default constructor. |
|
SegmentedConcurrentMap(int cInitialBuckets, float flLoadFactor, float flGrowthRate)Construct a thread-safe hash map using the specified settings. |
|
| Method Summary | |
|---|---|
void |
clear()Removes all mappings from this map. |
protected SegmentedConcurrentMap.LockAction |
getLockAction()Return the registered action for lock(). |
protected SegmentedConcurrentMap.SizeAction |
getSizeAction()Return the registered action for size(). |
protected SegmentedConcurrentMap.UnlockAction |
getUnlockAction()Return the registered action for unlock(). |
protected void |
initializeActions()Initialize the EntryAction's for this map. |
protected SegmentedHashMap.Entry |
instantiateEntry(java.lang.Object oKey, java.lang.Object oValue, int nHash)Factory for Entry. |
protected SegmentedConcurrentMap.LockAction |
instantiateLockAction()Factory for LockAction |
protected SegmentedHashMap.RemoveAction |
instantiateRemoveAction()Factory for RemoveAction |
protected SegmentedConcurrentMap.SizeAction |
instantiateSizeAction()Factory for SizeAction |
protected SegmentedConcurrentMap.UnlockAction |
instantiateUnlockAction()Factory for UnlockAction |
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. |
protected void |
setLockAction(SegmentedConcurrentMap.LockAction action)Specify the action for lock(). |
protected void |
setSizeAction(SegmentedConcurrentMap.SizeAction action)Specify the action for size(). |
protected void |
setUnlockAction(SegmentedConcurrentMap.UnlockAction action)Specify the action for unlock(). |
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 com.tangosol.util.ConcurrentMap |
|---|
containsKey, containsValue, get, put, putAll, remove |
| Methods inherited from interface java.util.Map |
|---|
entrySet, equals, hashCode, keySet, values |
| Field Detail |
|---|
protected ThreadGate m_gateLockAll
protected SegmentedConcurrentMap.LockAction m_actionLock
protected SegmentedConcurrentMap.UnlockAction m_actionUnlock
protected SegmentedConcurrentMap.SizeAction m_actionSize
| Constructor Detail |
|---|
public SegmentedConcurrentMap()
public SegmentedConcurrentMap(int cInitialBuckets,
float flLoadFactor,
float flGrowthRate)
cInitialBuckets - the initial number of hash buckets, 0 < nflLoadFactor - the acceptable load factor before resizing occurs, 0 < n, such that a load factor of 1.0 causes resizing when the number of entries exceeds the number of bucketsflGrowthRate - the rate of bucket growth when a resize occurs, 0 < n, such that a growth rate of 1.0 will double the number of buckets: bucketcount = bucketcount * (1 + growthrate)| Method Detail |
|---|
protected SegmentedConcurrentMap.LockAction getLockAction()
protected void setLockAction(SegmentedConcurrentMap.LockAction action)
action - the action for lock()protected SegmentedConcurrentMap.UnlockAction getUnlockAction()
protected void setUnlockAction(SegmentedConcurrentMap.UnlockAction action)
action - the action for unlock()protected SegmentedConcurrentMap.SizeAction getSizeAction()
protected void setSizeAction(SegmentedConcurrentMap.SizeAction action)
action - the action for size()public void clear()
clear in interface ConcurrentMapclear in interface java.util.Mapclear in class SegmentedHashMappublic int size()
size in interface ConcurrentMapsize in interface java.util.Mapsize in class SegmentedHashMappublic boolean isEmpty()
isEmpty in interface ConcurrentMapisEmpty in interface java.util.MapisEmpty in class SegmentedHashMappublic boolean lock(java.lang.Object oKey)
This method behaves exactly as if it simply performs the call lock(oKey, 0).
lock in interface ConcurrentMapoKey - key being locked
public 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 ConcurrentMap.LOCK_ALL as the oKey parameter to indicate the map lock.
lock in interface ConcurrentMapoKey - 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(java.lang.Object oKey)
unlock in interface ConcurrentMapoKey - key being unlockedprotected void initializeActions()
initializeActions in class SegmentedHashMapprotected SegmentedHashMap.RemoveAction instantiateRemoveAction()
instantiateRemoveAction in class SegmentedHashMapprotected SegmentedConcurrentMap.LockAction instantiateLockAction()
protected SegmentedConcurrentMap.UnlockAction instantiateUnlockAction()
protected SegmentedConcurrentMap.SizeAction instantiateSizeAction()
protected SegmentedHashMap.Entry instantiateEntry(java.lang.Object oKey,
java.lang.Object oValue,
int nHash)
instantiateEntry in class SegmentedHashMap
|
Oracle® Coherence Java API Reference Release 3.6.1.0 E18814-01 |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||