public final class IndexedQueueSizeUtil
extends java.lang.Object
producerIndex >= consumerIndex
As an invariant, but in a concurrent, long running settings all of the following need to be considered:
consumerIndex > producerIndex
: due to counter overflow (unlikey with longs, but easy to reason)
consumerIndex > producerIndex
: due to consumer FastFlow like implementation discovering the
element before the counter is updated.
producerIndex - consumerIndex < 0
: due to above.
producerIndex - consumerIndex > Integer.MAX_VALUE
: as linked buffers allow constructing queues
with more than Integer.MAX_VALUE
elements.
Modifier and Type | Class and Description |
---|---|
static interface |
IndexedQueueSizeUtil.IndexedQueue |
Modifier and Type | Field and Description |
---|---|
static int |
IGNORE_PARITY_DIVISOR |
static int |
PLAIN_DIVISOR |
Constructor and Description |
---|
IndexedQueueSizeUtil() |
Modifier and Type | Method and Description |
---|---|
static boolean |
isEmpty(IndexedQueueSizeUtil.IndexedQueue iq) |
static int |
sanitizedSize(int capacity,
long size) |
static int |
size(IndexedQueueSizeUtil.IndexedQueue iq,
int divisor) |
public static final int PLAIN_DIVISOR
public static final int IGNORE_PARITY_DIVISOR
public static int size(IndexedQueueSizeUtil.IndexedQueue iq, int divisor)
public static int sanitizedSize(int capacity, long size)
public static boolean isEmpty(IndexedQueueSizeUtil.IndexedQueue iq)