org.springframework.util

## 类 ConcurrentReferenceHashMap.Segment

- java.lang.Object
- - java.util.concurrent.locks.ReentrantLock
  - - org.springframework.util.ConcurrentReferenceHashMap.Segment

- 所有已实现的接口:
    Serializable, Lock
  封闭类:
    ConcurrentReferenceHashMap<K,V>

      protected final class ConcurrentReferenceHashMap.Segment
      extends ReentrantLock

  A single segment used to divide the map to allow better concurrent performance.
  另请参阅:
    序列化表格

- - ### 构造器概要

    构造器
    构造器和说明
    `Segment(int initialCapacity)`

  - ### 方法概要

    所有方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `void` | `clear()` Clear all items from this segment.
    `<T> T` | `doTask(int hash, Object key, org.springframework.util.ConcurrentReferenceHashMap.Task<T> task)` Apply an update operation to this segment.
    `int` | `getCount()` Return the total number of references in this segment.
    `ConcurrentReferenceHashMap.Reference<K,V>` | `getReference(Object key, int hash, ConcurrentReferenceHashMap.Restructure restructure)`
    `int` | `getSize()` Return the size of the current references array.
    `protected void` | `restructureIfNecessary(boolean allowResize)` Restructure the underlying data structure when it becomes necessary.

    - ### 从类继承的方法 java.util.concurrent.locks.ReentrantLock

      `getHoldCount, getOwner, getQueuedThreads, getQueueLength, getWaitingThreads, getWaitQueueLength, hasQueuedThread, hasQueuedThreads, hasWaiters, isFair, isHeldByCurrentThread, isLocked, lock, lockInterruptibly, newCondition, toString, tryLock, tryLock, unlock`

    - ### 从类继承的方法 java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### 构造器详细资料

    - #### Segment

          public Segment(int initialCapacity)

  - ### 方法详细资料

    - #### getReference

          @Nullable
          public ConcurrentReferenceHashMap.Reference<K,V> getReference(@Nullable
                                                                                   Object key,
                                                                                   int hash,
                                                                                   ConcurrentReferenceHashMap.Restructure restructure)

    - #### doTask

          @Nullable
          public <T> T doTask(int hash,
                                         @Nullable
                                         Object key,
                                         org.springframework.util.ConcurrentReferenceHashMap.Task<T> task)

      Apply an update operation to this segment. The segment will be locked during the update.
      参数:
        `hash` - the hash of the key
        `key` - the key
        `task` - the update operation
      返回:
        the result of the operation

    - #### clear

          public void clear()

      Clear all items from this segment.

    - #### restructureIfNecessary

          protected final void restructureIfNecessary(boolean allowResize)

      Restructure the underlying data structure when it becomes necessary. This method can increase the size of the references table as well as purge any references that have been garbage collected.
      参数:
        `allowResize` - if resizing is permitted

    - #### getSize

          public final int getSize()

      Return the size of the current references array.

    - #### getCount

          public final int getCount()

      Return the total number of references in this segment.