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> 
A single segment used to divide the map to allow better concurrent performance.
- Since:
- 3.2
- Author:
- Phillip Webb, Juergen Hoeller, Brian Clozel
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidclear()Clear all items from this segment.<T> @Nullable TdoTask(int hash, @Nullable Object key, ConcurrentReferenceHashMap<K, V>.org.springframework.util.ConcurrentReferenceHashMap.Task<T> task) Apply an update operation to this segment.intgetCount()Return the total number of references in this segment.getReference(@Nullable Object key, int hash, ConcurrentReferenceHashMap.Restructure restructure) intgetSize()Return the size of the current references array.Methods inherited from class ReentrantLockgetHoldCount, getOwner, getQueuedThreads, getQueueLength, getWaitingThreads, getWaitQueueLength, hasQueuedThread, hasQueuedThreads, hasWaiters, isFair, isHeldByCurrentThread, isLocked, lock, lockInterruptibly, newCondition, toString, tryLock, tryLock, unlock
- 
Constructor Details- 
Segmentpublic Segment(int initialSize, int resizeThreshold) 
 
- 
- 
Method Details- 
getReferencepublic @Nullable ConcurrentReferenceHashMap.Reference<K,V> getReference(@Nullable Object key, int hash, ConcurrentReferenceHashMap.Restructure restructure) 
- 
doTaskpublic <T> @Nullable 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
 
- 
clearpublic void clear()Clear all items from this segment.
- 
getSizepublic int getSize()Return the size of the current references array.
- 
getCountpublic int getCount()Return the total number of references in this segment.
 
-