Skip navigation links

Oracle® Coherence Java API Reference
Release 3.6.0.0

E15725-01


com.tangosol.util
Class SegmentedConcurrentMap.LockableEntry

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.util.SegmentedHashMap.Entry
          extended by com.tangosol.util.SegmentedConcurrentMap.LockableEntry

All Implemented Interfaces:
Map.Entry
Enclosing class:
SegmentedConcurrentMap

protected class SegmentedConcurrentMap.LockableEntry
extends SegmentedHashMap.Entry

LockableEntry is an Entry that supports locking. See ConcurrentMap


Field Summary
protected  short m_cContend
          The number of threads that are waiting to lock this Entry.
protected  short m_cLock
          The lock count (number of times the "lock()" was called by the locking thread).
protected  Object m_oLockHolder
          The lock holder object.

 

Fields inherited from class com.tangosol.util.SegmentedHashMap.Entry
m_eNext, m_nHash, m_oKey, m_oValue

 

Constructor Summary
protected SegmentedConcurrentMap.LockableEntry(Object oKey, Object oValue, int nHash)
          Construct a LockableEntry for the given entry.

 

Method Summary
protected  boolean isContended()
          Is there contention (a thread waiting) to lock this Entry?
protected  boolean isLocked()
          Is this entry Locked?
protected  boolean isSynthetic()
          Is this Entry synthetic?
protected  void lock(Object oHolder)
          Lock this entry for the specified lock holder.
 String toString()
          Render the map entry as a String.
protected  boolean unlock()
          Unlock this entry.
protected  long waitForNotify(long cWait)
          Wait for this LockableEntry to be notified that it has been freed by the previous lock-holder.

 

Methods inherited from class com.tangosol.util.SegmentedHashMap.Entry
equals, getKey, getValue, getValueInternal, hashCode, nextEntry, nextEntry, setNext, setValue, setValueInternal

 

Field Detail

m_oLockHolder

protected volatile Object m_oLockHolder
The lock holder object.

m_cLock

protected short m_cLock
The lock count (number of times the "lock()" was called by the locking thread).

m_cContend

protected volatile short m_cContend
The number of threads that are waiting to lock this Entry.

Constructor Detail

SegmentedConcurrentMap.LockableEntry

protected SegmentedConcurrentMap.LockableEntry(Object oKey,
                                               Object oValue,
                                               int nHash)
Construct a LockableEntry for the given entry.
Parameters:
oKey - key with which the specified value is to be associated
oValue - value to be associated with the specified key
nHash - the hashCode for the specified key

Method Detail

waitForNotify

protected long waitForNotify(long cWait)
Wait for this LockableEntry to be notified that it has been freed by the previous lock-holder. If the lock is being held by a thread and that thread has died, release the lock. <p/> Note: caller of this method is expected to hold a synchronization monitor for this LockableEntry object while making this call.
Parameters:
cWait - the number of milliseconds to wait for notification to obtain a lock; pass zero to return immediately; pass -1 to block the calling thread until the lock could be obtained
Returns:
updated wait time

lock

protected void lock(Object oHolder)
Lock this entry for the specified lock holder. <p/> Note: caller of this method is expected to have locked the segment for this Entry object
Parameters:
oHolder - the holder of this lock

unlock

protected boolean unlock()
Unlock this entry. <p/> Note: caller of this method is expected to have locked the segment for this Entry object
Returns:
true iff the Entry is completely unlocked

toString

public String toString()
Render the map entry as a String.
Overrides:
toString in class SegmentedHashMap.Entry
Returns:
the details about this entry

isLocked

protected boolean isLocked()
Is this entry Locked?

isContended

protected boolean isContended()
Is there contention (a thread waiting) to lock this Entry?

isSynthetic

protected boolean isSynthetic()
Is this Entry synthetic?
Overrides:
isSynthetic in class SegmentedHashMap.Entry

Skip navigation links

Oracle® Coherence Java API Reference
Release 3.6.0.0

E15725-01


Copyright © 2000, 2010, Oracle and/or its affiliates. All rights reserved.