public final class SpmcArrayQueue<E> extends ConcurrentCircularArrayQueue<E>
Modifier and Type | Field and Description |
---|---|
protected static long |
C_INDEX_OFFSET |
protected static long |
P_INDEX_OFFSET |
buffer, BUFFER_PAD, capacity, mask, SPARSE_SHIFT
Constructor and Description |
---|
SpmcArrayQueue(int capacity) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
casHead(long expect,
long newValue) |
boolean |
isEmpty() |
protected long |
lvConsumerIndex() |
protected long |
lvProducerIndex() |
protected long |
lvProducerIndexCache() |
boolean |
offer(E e) |
E |
peek() |
E |
poll() |
int |
size() |
protected void |
soTail(long v) |
protected void |
svProducerIndexCache(long v) |
calcElementOffset, iterator, lpElement, lpElement, lvElement, lvElement, soElement, soElement, spElement, spElement
contains, containsAll, remove, removeAll, retainAll, toArray, toArray, toString
protected static final long C_INDEX_OFFSET
protected static final long P_INDEX_OFFSET
public boolean offer(E e)
public E poll()
Note that we are not doing the the whole poll/tryPoll thing here like we do in MPMC/MPSC, that is because the problem we try to solve there is caused by having multiple producers making progress concurrently which can create 'bubbles' of claimed but not fully visible elements in the queue. For a single producer the problem doesn't exist.
public E peek()
public int size()
public boolean isEmpty()
protected final long lvProducerIndexCache()
protected final void svProducerIndexCache(long v)
protected final long lvConsumerIndex()
protected final boolean casHead(long expect, long newValue)
protected final long lvProducerIndex()
protected final void soTail(long v)