Class ConcurrentReferenceHashMap.Segment

java.lang.Object
java.util.concurrent.locks.ReentrantLock
org.springframework.util.ConcurrentReferenceHashMap.Segment
All Implemented Interfaces:
Serializable, Lock
Enclosing class:
ConcurrentReferenceHashMap<K,V>

protected final class ConcurrentReferenceHashMap.Segment extends ReentrantLock
A single segment used to divide the map to allow better concurrent performance.
See Also:
  • Constructor Details

    • Segment

      public Segment(int initialSize, int resizeThreshold)
  • Method Details

    • getReference

    • doTask

      @Nullable public <T> T doTask(int hash, @Nullable Object key, ConcurrentReferenceHashMap<K,V>.org.springframework.util.ConcurrentReferenceHashMap.Task<T> task)
      Apply an update operation to this segment. The segment will be locked during the update.
      Parameters:
      hash - the hash of the key
      key - the key
      task - the update operation
      Returns:
      the result of the operation
    • clear

      public void clear()
      Clear all items from this segment.
    • getSize

      public int getSize()
      Return the size of the current references array.
    • getCount

      public int getCount()
      Return the total number of references in this segment.