Package com.google.common.collect
Class MapMakerInternalMap.StrongKeyWeakValueSegment<K,V>
- java.lang.Object
-
- java.util.concurrent.locks.ReentrantLock
-
- com.google.common.collect.MapMakerInternalMap.Segment<K,V,MapMakerInternalMap.StrongKeyWeakValueEntry<K,V>,MapMakerInternalMap.StrongKeyWeakValueSegment<K,V>>
-
- com.google.common.collect.MapMakerInternalMap.StrongKeyWeakValueSegment<K,V>
-
- All Implemented Interfaces:
java.io.Serializable,java.util.concurrent.locks.Lock
- Enclosing class:
- MapMakerInternalMap<K,V,E extends MapMakerInternalMap.InternalEntry<K,V,E>,S extends MapMakerInternalMap.Segment<K,V,E,S>>
static final class MapMakerInternalMap.StrongKeyWeakValueSegment<K,V> extends MapMakerInternalMap.Segment<K,V,MapMakerInternalMap.StrongKeyWeakValueEntry<K,V>,MapMakerInternalMap.StrongKeyWeakValueSegment<K,V>>
Concrete implementation ofMapMakerInternalMap.Segmentfor strong keys and weak values.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.ref.ReferenceQueue<V>queueForValues-
Fields inherited from class com.google.common.collect.MapMakerInternalMap.Segment
count, map, maxSegmentSize, modCount, readCount, table, threshold
-
-
Constructor Summary
Constructors Constructor Description StrongKeyWeakValueSegment(MapMakerInternalMap<K,V,MapMakerInternalMap.StrongKeyWeakValueEntry<K,V>,MapMakerInternalMap.StrongKeyWeakValueSegment<K,V>> map, int initialCapacity, int maxSegmentSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MapMakerInternalMap.StrongKeyWeakValueEntry<K,V>castForTesting(MapMakerInternalMap.InternalEntry<K,V,?> entry)Unsafe cast of the given entry toE, the type of the specificMapMakerInternalMap.InternalEntryimplementation type.(package private) java.lang.ref.ReferenceQueue<V>getValueReferenceQueueForTesting()Unsafely extracts the value reference queue used by this segment.MapMakerInternalMap.WeakValueReference<K,V,MapMakerInternalMap.StrongKeyWeakValueEntry<K,V>>getWeakValueReferenceForTesting(MapMakerInternalMap.InternalEntry<K,V,?> e)Unsafely extracts the weak value reference inside of the givenentry.(package private) voidmaybeClearReferenceQueues()Clears the reference queues used by this segment, if any.(package private) voidmaybeDrainReferenceQueues()Drains the reference queues used by this segment, if any.MapMakerInternalMap.WeakValueReference<K,V,MapMakerInternalMap.StrongKeyWeakValueEntry<K,V>>newWeakValueReferenceForTesting(MapMakerInternalMap.InternalEntry<K,V,?> e, V value)Unsafely creates of a freshMapMakerInternalMap.WeakValueReference, referencing the givenvalue, for the givenentry(package private) MapMakerInternalMap.StrongKeyWeakValueSegment<K,V>self()voidsetWeakValueReferenceForTesting(MapMakerInternalMap.InternalEntry<K,V,?> e, MapMakerInternalMap.WeakValueReference<K,V,? extends MapMakerInternalMap.InternalEntry<K,V,?>> valueReference)Unsafely sets the weak value reference inside the givenentryto be the givenvalueReference-
Methods inherited from class com.google.common.collect.MapMakerInternalMap.Segment
clear, clearReferenceQueue, clearValueForTesting, containsKey, containsValue, copyEntry, copyForTesting, drainKeyReferenceQueue, drainValueReferenceQueue, expand, get, getEntry, getFirst, getKeyReferenceQueueForTesting, getLiveEntry, getLiveValue, getLiveValueForTesting, initTable, isCollected, newEntryArray, newEntryForTesting, postReadCleanup, preWriteCleanup, put, reclaimKey, reclaimValue, remove, remove, removeEntryForTesting, removeFromChain, removeFromChainForTesting, removeTableEntryForTesting, replace, replace, runCleanup, runLockedCleanup, setTableEntryForTesting, setValue, setValueForTesting, tryDrainReferenceQueues
-
Methods inherited from class java.util.concurrent.locks.ReentrantLock
getHoldCount, getOwner, getQueuedThreads, getQueueLength, getWaitingThreads, getWaitQueueLength, hasQueuedThread, hasQueuedThreads, hasWaiters, isFair, isHeldByCurrentThread, isLocked, lock, lockInterruptibly, newCondition, toString, tryLock, tryLock, unlock
-
-
-
-
Field Detail
-
queueForValues
private final java.lang.ref.ReferenceQueue<V> queueForValues
-
-
Constructor Detail
-
StrongKeyWeakValueSegment
StrongKeyWeakValueSegment(MapMakerInternalMap<K,V,MapMakerInternalMap.StrongKeyWeakValueEntry<K,V>,MapMakerInternalMap.StrongKeyWeakValueSegment<K,V>> map, int initialCapacity, int maxSegmentSize)
-
-
Method Detail
-
self
MapMakerInternalMap.StrongKeyWeakValueSegment<K,V> self()
Description copied from class:MapMakerInternalMap.SegmentReturnsthisup-casted to the specificMapMakerInternalMap.Segmentimplementation typeS.This method exists so that the
MapMakerInternalMap.Segmentcode can be generic in terms ofS, the type of the concrete implementation.- Specified by:
selfin classMapMakerInternalMap.Segment<K,V,MapMakerInternalMap.StrongKeyWeakValueEntry<K,V>,MapMakerInternalMap.StrongKeyWeakValueSegment<K,V>>
-
getValueReferenceQueueForTesting
java.lang.ref.ReferenceQueue<V> getValueReferenceQueueForTesting()
Description copied from class:MapMakerInternalMap.SegmentUnsafely extracts the value reference queue used by this segment.
-
castForTesting
public MapMakerInternalMap.StrongKeyWeakValueEntry<K,V> castForTesting(MapMakerInternalMap.InternalEntry<K,V,?> entry)
Description copied from class:MapMakerInternalMap.SegmentUnsafe cast of the given entry toE, the type of the specificMapMakerInternalMap.InternalEntryimplementation type.This method is provided as a convenience for tests. Otherwise they'd need to be knowledgable about all the implementation details of our type system trickery.
- Specified by:
castForTestingin classMapMakerInternalMap.Segment<K,V,MapMakerInternalMap.StrongKeyWeakValueEntry<K,V>,MapMakerInternalMap.StrongKeyWeakValueSegment<K,V>>
-
getWeakValueReferenceForTesting
public MapMakerInternalMap.WeakValueReference<K,V,MapMakerInternalMap.StrongKeyWeakValueEntry<K,V>> getWeakValueReferenceForTesting(MapMakerInternalMap.InternalEntry<K,V,?> e)
Description copied from class:MapMakerInternalMap.SegmentUnsafely extracts the weak value reference inside of the givenentry.
-
newWeakValueReferenceForTesting
public MapMakerInternalMap.WeakValueReference<K,V,MapMakerInternalMap.StrongKeyWeakValueEntry<K,V>> newWeakValueReferenceForTesting(MapMakerInternalMap.InternalEntry<K,V,?> e, V value)
Description copied from class:MapMakerInternalMap.SegmentUnsafely creates of a freshMapMakerInternalMap.WeakValueReference, referencing the givenvalue, for the givenentry
-
setWeakValueReferenceForTesting
public void setWeakValueReferenceForTesting(MapMakerInternalMap.InternalEntry<K,V,?> e, MapMakerInternalMap.WeakValueReference<K,V,? extends MapMakerInternalMap.InternalEntry<K,V,?>> valueReference)
Description copied from class:MapMakerInternalMap.SegmentUnsafely sets the weak value reference inside the givenentryto be the givenvalueReference
-
maybeDrainReferenceQueues
void maybeDrainReferenceQueues()
Description copied from class:MapMakerInternalMap.SegmentDrains the reference queues used by this segment, if any.- Overrides:
maybeDrainReferenceQueuesin classMapMakerInternalMap.Segment<K,V,MapMakerInternalMap.StrongKeyWeakValueEntry<K,V>,MapMakerInternalMap.StrongKeyWeakValueSegment<K,V>>
-
maybeClearReferenceQueues
void maybeClearReferenceQueues()
Description copied from class:MapMakerInternalMap.SegmentClears the reference queues used by this segment, if any.- Overrides:
maybeClearReferenceQueuesin classMapMakerInternalMap.Segment<K,V,MapMakerInternalMap.StrongKeyWeakValueEntry<K,V>,MapMakerInternalMap.StrongKeyWeakValueSegment<K,V>>
-
-