public class MpscUnboundedUnpaddedArrayQueue<E> extends BaseMpscLinkedUnpaddedArrayQueue<E>
MessagePassingQueue.Consumer<T>, MessagePassingQueue.ExitCondition, MessagePassingQueue.Supplier<T>, MessagePassingQueue.WaitStrategy
producerBuffer, producerMask
consumerBuffer, consumerMask
UNBOUNDED_CAPACITY
Constructor and Description |
---|
MpscUnboundedUnpaddedArrayQueue(int chunkSize) |
Modifier and Type | Method and Description |
---|---|
protected long |
availableInQueue(long pIndex,
long cIndex) |
int |
capacity() |
int |
drain(MessagePassingQueue.Consumer<E> c)
Remove all available item from the queue and hand to consume.
|
int |
fill(MessagePassingQueue.Supplier<E> s)
Stuff the queue with elements from the supplier.
|
protected long |
getCurrentBufferCapacity(long mask) |
protected int |
getNextBufferSize(E[] buffer) |
currentConsumerIndex, currentProducerIndex, drain, drain, fill, fill, isEmpty, iterator, offer, peek, poll, relaxedOffer, relaxedPeek, relaxedPoll, size, toString
casProducerLimit, lvProducerLimit, soProducerLimit
lpConsumerIndex, lvConsumerIndex, soConsumerIndex
casProducerIndex, lvProducerIndex, soProducerIndex
contains, containsAll, remove, removeAll, retainAll, toArray, toArray
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
clear
public MpscUnboundedUnpaddedArrayQueue(int chunkSize)
protected long availableInQueue(long pIndex, long cIndex)
availableInQueue
in class BaseMpscLinkedUnpaddedArrayQueue<E>
public int capacity()
capacity
in interface IndexedQueueSizeUtil.IndexedQueue
capacity
in interface MessagePassingQueue<E>
capacity
in class BaseMpscLinkedUnpaddedArrayQueue<E>
MessagePassingQueue.UNBOUNDED_CAPACITY
if not boundedpublic int drain(MessagePassingQueue.Consumer<E> c)
MessagePassingQueue
M m; while((m = relaxedPoll()) != null){ c.accept(m); }There's no strong commitment to the queue being empty at the end of a drain. Called from a consumer thread subject to the restrictions appropriate to the implementation.
WARNING: Explicit assumptions are made with regards to MessagePassingQueue.Consumer.accept(T)
make sure you have read
and understood these before using this method.
drain
in interface MessagePassingQueue<E>
drain
in class BaseMpscLinkedUnpaddedArrayQueue<E>
public int fill(MessagePassingQueue.Supplier<E> s)
MessagePassingQueue
while(relaxedOffer(s.get());There's no strong commitment to the queue being full at the end of a fill. Called from a producer thread subject to the restrictions appropriate to the implementation.
Unbounded queues will fill up the queue with a fixed amount rather than fill up to oblivion.
WARNING: Explicit assumptions are made with regards to MessagePassingQueue.Supplier.get()
make sure you have read
and understood these before using this method.
fill
in interface MessagePassingQueue<E>
fill
in class BaseMpscLinkedUnpaddedArrayQueue<E>
protected int getNextBufferSize(E[] buffer)
getNextBufferSize
in class BaseMpscLinkedUnpaddedArrayQueue<E>
protected long getCurrentBufferCapacity(long mask)
getCurrentBufferCapacity
in class BaseMpscLinkedUnpaddedArrayQueue<E>