Home » openjdk-7 » java » util » concurrent » [javadoc | source]
java.util.concurrent
static final class: ConcurrentHashMap.Segment [javadoc | source]
java.lang.Object
   java.util.concurrent.locks.ReentrantLock
      java.util.concurrent.ConcurrentHashMap$Segment

All Implemented Interfaces:
    java$io$Serializable, Lock

Segments are specialized versions of hash tables. This subclasses from ReentrantLock opportunistically, just to simplify some locking and avoid separate construction.
Field Summary
static final  int MAX_SCAN_RETRIES    The maximum number of times to tryLock in a prescan before possibly blocking on acquire in preparation for a locked segment operation. On multiprocessors, using a bounded number of retries maintains cache acquired while locating nodes. 
transient volatile  HashEntry<K, V>[] table    The per-segment table. Elements are accessed via entryAt/setEntryAt providing volatile semantics. 
transient  int count    The number of elements. Accessed only either within locks or among other volatile reads that maintain visibility. 
transient  int modCount    The total number of mutative operations in this segment. Even though this may overflows 32 bits, it provides sufficient accuracy for stability checks in CHM isEmpty() and size() methods. Accessed only either within locks or among other volatile reads that maintain visibility. 
transient  int threshold    The table is rehashed when its size exceeds this threshold. (The value of this field is always (int)(capacity * loadFactor).) 
final  float loadFactor    The load factor for the hash table. Even though this value is same for all segments, it is replicated to avoid needing links to outer object.
    serial:
 
Constructor:
 Segment(float lf,
    int threshold,
    HashEntry<K, V>[] tab) 
Method from java.util.concurrent.ConcurrentHashMap$Segment Summary:
clear,   put,   remove,   replace,   replace
Methods from java.util.concurrent.locks.ReentrantLock:
getHoldCount,   getOwner,   getQueueLength,   getQueuedThreads,   getWaitQueueLength,   getWaitingThreads,   hasQueuedThread,   hasQueuedThreads,   hasWaiters,   isFair,   isHeldByCurrentThread,   isLocked,   lock,   lockInterruptibly,   newCondition,   toString,   tryLock,   tryLock,   unlock
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from java.util.concurrent.ConcurrentHashMap$Segment Detail:
 final  void clear() 
 final V put(K key,
    int hash,
    V value,
    boolean onlyIfAbsent) 
 final V remove(Object key,
    int hash,
    Object value) 
    Remove; match on key only if value null, else match both.
 final V replace(K key,
    int hash,
    V value) 
 final boolean replace(K key,
    int hash,
    V oldValue,
    V newValue)