Class MpscGrowableArrayQueue<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractQueue<E>
com.github.benmanes.caffeine.cache.BaseMpscLinkedArrayQueuePad1<E>
com.github.benmanes.caffeine.cache.BaseMpscLinkedArrayQueueProducerFields<E>
com.github.benmanes.caffeine.cache.BaseMpscLinkedArrayQueuePad2<E>
com.github.benmanes.caffeine.cache.BaseMpscLinkedArrayQueueConsumerFields<E>
com.github.benmanes.caffeine.cache.BaseMpscLinkedArrayQueuePad3<E>
com.github.benmanes.caffeine.cache.BaseMpscLinkedArrayQueueColdProducerFields<E>
com.github.benmanes.caffeine.cache.BaseMpscLinkedArrayQueue<E>
com.github.benmanes.caffeine.cache.MpscChunkedArrayQueueColdProducerFields<E>
com.github.benmanes.caffeine.cache.MpscChunkedArrayQueue<E>
com.github.benmanes.caffeine.cache.MpscGrowableArrayQueue<E>
- All Implemented Interfaces:
Iterable<E>, Collection<E>, Queue<E>
An MPSC array queue which starts at initialCapacity and grows to maxCapacity in
linked chunks of the initial size. The queue grows only when the current buffer is full and
elements are not copied on resize, instead a link to the new buffer is stored in the old buffer
for the consumer to follow.
This is a shaded copy of MpscGrowableArrayQueue provided by JCTools from version 2.0.
-
Field Summary
Fields inherited from class MpscChunkedArrayQueue
p000, p001, p002, p003, p004, p005, p006, p007, p008, p009, p010, p011, p012, p013, p014, p015, p016, p017, p018, p019, p020, p021, p022, p023, p024, p025, p026, p027, p028, p029, p030, p031, p032, p033, p034, p035, p036, p037, p038, p039, p040, p041, p042, p043, p044, p045, p046, p047, p048, p049, p050, p051, p052, p053, p054, p055, p056, p057, p058, p059, p060, p061, p062, p063, p064, p065, p066, p067, p068, p069, p070, p071, p072, p073, p074, p075, p076, p077, p078, p079, p080, p081, p082, p083, p084, p085, p086, p087, p088, p089, p090, p091, p092, p093, p094, p095, p096, p097, p098, p099, p100, p101, p102, p103, p104, p105, p106, p107, p108, p109, p110, p111, p112, p113, p114, p115, p116, p117, p118, p119Fields inherited from class MpscChunkedArrayQueueColdProducerFields
maxQueueCapacityFields inherited from class BaseMpscLinkedArrayQueueColdProducerFields
producerBuffer, producerLimit, producerMaskFields inherited from class BaseMpscLinkedArrayQueueConsumerFields
consumerBuffer, consumerIndex, consumerMaskFields inherited from class BaseMpscLinkedArrayQueueProducerFields
producerIndex -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected longgetCurrentBufferCapacity(long mask) protected intgetNextBufferSize(E[] buffer) Methods inherited from class MpscChunkedArrayQueue
availableInQueue, capacityMethods inherited from class BaseMpscLinkedArrayQueue
allocate, currentConsumerIndex, currentProducerIndex, isEmpty, iterator, offer, peek, poll, relaxedOffer, relaxedPeek, relaxedPoll, size, toStringMethods inherited from class AbstractCollection
contains, containsAll, remove, removeAll, retainAll, toArray, toArrayMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Collection
contains, containsAll, equals, hashCode, parallelStream, remove, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray, toArray
-
Constructor Details
-
MpscGrowableArrayQueue
MpscGrowableArrayQueue(int initialCapacity, int maxCapacity) - Parameters:
initialCapacity- the queue initial capacity. If chunk size is fixed this will be the chunk size. Must be 2 or more.maxCapacity- the maximum capacity will be rounded up to the closest power of 2 and will be the upper limit of number of elements in this queue. Must be 4 or more and round up to a larger power of 2 than initialCapacity.
-
-
Method Details
-
getNextBufferSize
- Overrides:
getNextBufferSizein classMpscChunkedArrayQueue<E>- Returns:
- next buffer size(inclusive of next array pointer)
-
getCurrentBufferCapacity
protected long getCurrentBufferCapacity(long mask) - Overrides:
getCurrentBufferCapacityin classMpscChunkedArrayQueue<E>- Returns:
- current buffer capacity for elements (excluding next pointer and jump entry) * 2
-