@SuppressAnimalSniffer 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, mask, SPARSE_SHIFT
Constructor and Description |
---|
SpmcArrayQueue(int capacity) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
casHead(long expect,
long newValue) |
boolean |
isEmpty()
This method's accuracy is subject to concurrent modifications happening as the observation is carried out.
|
protected long |
lvConsumerIndex() |
protected long |
lvProducerIndex() |
protected long |
lvProducerIndexCache() |
boolean |
offer(E e)
Called from a producer thread subject to the restrictions appropriate to the implementation and according to the
Queue.offer(Object) interface. |
E |
peek()
Called from the consumer thread subject to the restrictions appropriate to the implementation and according to
the
Queue.peek() interface. |
E |
poll()
Called from the consumer thread subject to the restrictions appropriate to the implementation and according to
the
Queue.poll() interface. |
int |
size()
This method's accuracy is subject to concurrent modifications happening as the size is estimated and as such is a
best effort rather than absolute value.
|
protected void |
soTail(long v) |
protected void |
svProducerIndexCache(long v) |
calcElementOffset, calcElementOffset, clear, iterator, lpElement, lpElement, lvElement, lvElement, soElement, soElement, spElement, spElement
add, addAll, element, remove
contains, containsAll, remove, removeAll, retainAll, toArray, toArray, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
contains, containsAll, equals, hashCode, parallelStream, remove, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray
protected static final long C_INDEX_OFFSET
protected static final long P_INDEX_OFFSET
public boolean offer(E e)
MessagePassingQueue
Queue.offer(Object)
interface.e
- the Object to enqueue, not nullpublic E poll()
MessagePassingQueue
Queue.poll()
interface.public E peek()
MessagePassingQueue
Queue.peek()
interface.public int size()
MessagePassingQueue
size
in interface Collection<E>
size
in interface MessagePassingQueue<E>
size
in class AbstractCollection<E>
Integer.MAX_VALUE
if not boundedpublic boolean isEmpty()
MessagePassingQueue
isEmpty
in interface Collection<E>
isEmpty
in interface MessagePassingQueue<E>
isEmpty
in class AbstractCollection<E>
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)
Copyright © 2017. All rights reserved.