类 ConcurrentReferenceHashMap.Segment
- java.lang.Object
-
- java.util.concurrent.locks.ReentrantLock
-
- cc.shacocloud.mirage.utils.map.ConcurrentReferenceHashMap.Segment
-
- 所有已实现的接口:
Serializable,Lock
- 封闭类:
- ConcurrentReferenceHashMap<K,V>
protected final class ConcurrentReferenceHashMap.Segment extends ReentrantLock
用于划分映射以允许更好的并发性能的单个段- 另请参阅:
- 序列化表格
-
-
构造器概要
构造器 构造器 说明 Segment(int initialSize, int resizeThreshold)
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voidclear()清除此细分中的所有项目<T> TdoTask(int hash, @Nullable Object key, cc.shacocloud.mirage.utils.map.ConcurrentReferenceHashMap.Task<T> task)将更新操作应用于此段。intgetCount()返回此段中的引用总数。@Nullable ConcurrentReferenceHashMap.Reference<K,V>getReference(@Nullable Object key, int hash, ConcurrentReferenceHashMap.Restructure restructure)intgetSize()返回当前引用数组的大小。-
从类继承的方法 java.util.concurrent.locks.ReentrantLock
getHoldCount, getOwner, getQueuedThreads, getQueueLength, getWaitingThreads, getWaitQueueLength, hasQueuedThread, hasQueuedThreads, hasWaiters, isFair, isHeldByCurrentThread, isLocked, lock, lockInterruptibly, newCondition, toString, tryLock, tryLock, unlock
-
-
-
-
方法详细资料
-
getReference
@Nullable public @Nullable ConcurrentReferenceHashMap.Reference<K,V> getReference(@Nullable @Nullable Object key, int hash, ConcurrentReferenceHashMap.Restructure restructure)
-
doTask
@Nullable public <T> T doTask(int hash, @Nullable @Nullable Object key, cc.shacocloud.mirage.utils.map.ConcurrentReferenceHashMap.Task<T> task)将更新操作应用于此段。该段将在更新期间被锁定。- 参数:
hash- 键的哈希值key- 键task- 更新操作- 返回:
- 操作的结果
-
clear
public void clear()
清除此细分中的所有项目
-
getSize
public int getSize()
返回当前引用数组的大小。
-
getCount
public int getCount()
返回此段中的引用总数。
-
-