Class ConcurrentIdentityWeakKeyHashMap.Segment<K,V>

java.lang.Object
java.util.concurrent.locks.ReentrantLock
org.jboss.netty.util.internal.ConcurrentIdentityWeakKeyHashMap.Segment<K,V>
All Implemented Interfaces:
Serializable, Lock
Enclosing class:
ConcurrentIdentityWeakKeyHashMap<K,V>

static final class ConcurrentIdentityWeakKeyHashMap.Segment<K,V> extends ReentrantLock
Segments are specialized versions of hash tables. This subclasses from ReentrantLock opportunistically, just to simplify some locking and avoid separate construction.
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • count

      transient volatile int count
      The number of elements in this segment's region.
    • modCount

      int modCount
      Number of updates that alter the size of the table. This is used during bulk-read methods to make sure they see a consistent snapshot: If modCounts change during a traversal of segments computing size or checking containsValue, then we might have an inconsistent view of state so (usually) must retry.
    • threshold

      int threshold
      The table is rehashed when its size exceeds this threshold. (The value of this field is always (capacity * loadFactor).)
    • table

      transient volatile ConcurrentIdentityWeakKeyHashMap.HashEntry<K,V>[] table
      The per-segment table.
    • 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.
    • refQueue

      transient volatile ReferenceQueue<Object> refQueue
      The collected weak-key reference queue for this segment. This should be (re)initialized whenever table is assigned,
  • Constructor Details

    • Segment

      Segment(int initialCapacity, float lf)
  • Method Details