E - type of the element stored in the Queuepublic class MpmcArrayQueue<E> extends ConcurrentSequencedCircularArrayQueue<E>
ConcurrentCircularArrayQueue. This implies that
any and all threads may call the offer/poll/peek methods and correctness is maintained. sequenceBufferbuffer, BUFFER_PAD, capacity, mask, SPARSE_SHIFT| Constructor and Description |
|---|
MpmcArrayQueue(int capacity) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
casConsumerIndex(long expect,
long newValue) |
protected boolean |
casProducerIndex(long expect,
long newValue) |
boolean |
isEmpty() |
protected long |
lvConsumerIndex() |
protected long |
lvProducerIndex() |
boolean |
offer(E e) |
E |
peek() |
E |
poll() |
int |
size() |
calcSequenceOffset, lvSequence, soSequencecalcElementOffset, clear, iterator, lpElement, lpElement, lvElement, lvElement, soElement, soElement, spElement, spElementadd, addAll, element, removecontains, containsAll, remove, removeAll, retainAll, toArray, toArray, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcontains, containsAll, equals, hashCode, parallelStream, remove, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArraypublic boolean offer(E e)
public E poll()
Because return null indicates queue is empty we cannot simply rely on next element visibility for poll and must test producer index when next element is not visible.
public E peek()
public int size()
size in interface Collection<E>size in class AbstractCollection<E>public boolean isEmpty()
isEmpty in interface Collection<E>isEmpty in class AbstractCollection<E>protected final long lvConsumerIndex()
protected final boolean casConsumerIndex(long expect,
long newValue)
protected final long lvProducerIndex()
protected final boolean casProducerIndex(long expect,
long newValue)
Copyright © 2013–2014. All rights reserved.