E - public abstract class BaseMpscLinkedArrayQueue<E> extends AbstractQueue<E> implements MessagePassingQueue<E>, QueueProgressIndicators
MessagePassingQueue.Consumer<T>, MessagePassingQueue.ExitCondition, MessagePassingQueue.Supplier<T>, MessagePassingQueue.WaitStrategy| Modifier and Type | Field and Description |
|---|---|
protected E[] |
consumerBuffer |
protected long |
consumerMask |
protected E[] |
producerBuffer |
protected long |
producerMask |
UNBOUNDED_CAPACITY| Constructor and Description |
|---|
BaseMpscLinkedArrayQueue(int initialCapacity) |
contains, containsAll, remove, removeAll, retainAll, toArray, toArrayclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitclearcontains, containsAll, equals, hashCode, parallelStream, remove, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArrayprotected long producerMask
protected E[] producerBuffer
protected long consumerMask
protected E[] consumerBuffer
public BaseMpscLinkedArrayQueue(int initialCapacity)
initialCapacity - the queue initial capacity. If chunk size is fixed this will be the
chunk size. Must be 2 or more.public final int size()
size in interface MessagePassingQueue<E>size in interface Collection<E>size in class AbstractCollection<E>public final boolean isEmpty()
isEmpty in interface MessagePassingQueue<E>isEmpty in interface Collection<E>isEmpty in class AbstractCollection<E>public String toString()
toString in class AbstractCollection<E>public boolean offer(E e)
public E poll()
This implementation is correct for single consumer thread use only.
public E peek()
This implementation is correct for single consumer thread use only.
protected abstract long availableInQueue(long pIndex,
long cIndex)
public long currentProducerIndex()
QueueProgressIndicatorscurrentProducerIndex in interface QueueProgressIndicatorspublic long currentConsumerIndex()
QueueProgressIndicatorscurrentConsumerIndex in interface QueueProgressIndicatorspublic abstract int capacity()
capacity in interface MessagePassingQueue<E>public boolean relaxedOffer(E e)
relaxedOffer in interface MessagePassingQueue<E>public E relaxedPoll()
relaxedPoll in interface MessagePassingQueue<E>public E relaxedPeek()
relaxedPeek in interface MessagePassingQueue<E>public int fill(MessagePassingQueue.Supplier<E> s)
fill in interface MessagePassingQueue<E>public int fill(MessagePassingQueue.Supplier<E> s, int batchSize)
fill in interface MessagePassingQueue<E>public void fill(MessagePassingQueue.Supplier<E> s, MessagePassingQueue.WaitStrategy w, MessagePassingQueue.ExitCondition exit)
fill in interface MessagePassingQueue<E>public int drain(MessagePassingQueue.Consumer<E> c)
drain in interface MessagePassingQueue<E>public int drain(MessagePassingQueue.Consumer<E> c, int limit)
drain in interface MessagePassingQueue<E>public void drain(MessagePassingQueue.Consumer<E> c, MessagePassingQueue.WaitStrategy w, MessagePassingQueue.ExitCondition exit)
drain in interface MessagePassingQueue<E>public Iterator<E> iterator()
The iterator provides a best-effort snapshot of the elements in the queue. The returned iterator is not guaranteed to return elements in queue order, and races with the consumer thread may cause gaps in the sequence of returned elements. Like {link #relaxedPoll}, the iterator may not immediately return newly inserted elements.
iterator in interface Iterable<E>iterator in interface Collection<E>iterator in class AbstractCollection<E>protected abstract int getNextBufferSize(E[] buffer)
protected abstract long getCurrentBufferCapacity(long mask)
public final long lvConsumerIndex()
public final long lvProducerIndex()