Class BLCHeader.DrainStatusRef<K,V>
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- com.github.benmanes.caffeine.cache.BLCHeader.PadDrainStatus<K,V>
-
- com.github.benmanes.caffeine.cache.BLCHeader.DrainStatusRef<K,V>
-
- All Implemented Interfaces:
java.util.Map<K,V>
- Direct Known Subclasses:
BoundedLocalCache
- Enclosing class:
- BLCHeader
abstract static class BLCHeader.DrainStatusRef<K,V> extends BLCHeader.PadDrainStatus<K,V>
Enforces a memory layout to avoid false sharing by padding the drain status.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static long
DRAIN_STATUS_OFFSET
(package private) int
drainStatus
The draining status of the buffers.(package private) static int
IDLE
A drain is not taking place.(package private) static int
PROCESSING_TO_IDLE
A drain is in progress and will transition to idle.(package private) static int
PROCESSING_TO_REQUIRED
A drain is in progress and will transition to required.(package private) static int
REQUIRED
A drain is required due to a pending write modification.
-
Constructor Summary
Constructors Constructor Description DrainStatusRef()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) boolean
casDrainStatus(int expect, int update)
(package private) int
drainStatus()
(package private) void
lazySetDrainStatus(int drainStatus)
(package private) boolean
shouldDrainBuffers(boolean delayable)
Returns whether maintenance work is needed.-
Methods inherited from class java.util.AbstractMap
clear, clone, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, toString, values
-
-
-
-
Field Detail
-
DRAIN_STATUS_OFFSET
static final long DRAIN_STATUS_OFFSET
-
IDLE
static final int IDLE
A drain is not taking place.- See Also:
- Constant Field Values
-
REQUIRED
static final int REQUIRED
A drain is required due to a pending write modification.- See Also:
- Constant Field Values
-
PROCESSING_TO_IDLE
static final int PROCESSING_TO_IDLE
A drain is in progress and will transition to idle.- See Also:
- Constant Field Values
-
PROCESSING_TO_REQUIRED
static final int PROCESSING_TO_REQUIRED
A drain is in progress and will transition to required.- See Also:
- Constant Field Values
-
drainStatus
volatile int drainStatus
The draining status of the buffers.
-
-
Method Detail
-
shouldDrainBuffers
boolean shouldDrainBuffers(boolean delayable)
Returns whether maintenance work is needed.- Parameters:
delayable
- if draining the read buffer can be delayed
-
drainStatus
int drainStatus()
-
lazySetDrainStatus
void lazySetDrainStatus(int drainStatus)
-
casDrainStatus
boolean casDrainStatus(int expect, int update)
-
-