public class SpscUnboundedArrayQueue<E> extends AbstractQueue<E>
Modifier and Type | Field and Description |
---|---|
protected E[] |
consumerBuffer |
protected long |
consumerIndex |
protected long |
consumerMask |
protected static Object |
JUMP |
protected E[] |
producerBuffer |
protected long |
producerBufferLimit |
protected long |
producerIndex |
protected long |
producerMask |
Constructor and Description |
---|
SpscUnboundedArrayQueue(int chunkSize) |
Modifier and Type | Method and Description |
---|---|
long |
currentConsumerIndex()
This method has no concurrent visibility semantics.
|
long |
currentProducerIndex()
This method has no concurrent visibility semantics.
|
boolean |
isEmpty() |
Iterator<E> |
iterator() |
protected void |
linkOldToNew(long currIndex,
E[] oldBuffer,
long offset,
E[] newBuffer,
long offsetInNew,
E e) |
long |
lvConsumerIndex() |
protected E[] |
lvNextArrayAndUnlink(E[] curr) |
long |
lvProducerIndex() |
boolean |
offer(E e) |
protected boolean |
offerColdPath(E[] buffer,
long mask,
E e,
long pIndex,
long offset) |
E |
peek() |
E |
poll() |
int |
size() |
protected void |
soConsumerIndex(long v) |
protected void |
soNext(E[] curr,
E[] next) |
protected void |
soProducerIndex(long v) |
String |
toString() |
protected void |
writeToQueue(E[] buffer,
E e,
long index,
long offset) |
contains, containsAll, remove, removeAll, retainAll, toArray, toArray
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 Object JUMP
protected long producerBufferLimit
protected long producerMask
protected E[] producerBuffer
protected long producerIndex
protected long consumerIndex
protected long consumerMask
protected E[] consumerBuffer
protected final void soProducerIndex(long v)
protected final void soConsumerIndex(long v)
public final long lvProducerIndex()
lvProducerIndex
in interface IndexedQueueSizeUtil.IndexedQueue
public final long lvConsumerIndex()
lvConsumerIndex
in interface IndexedQueueSizeUtil.IndexedQueue
public final Iterator<E> iterator()
iterator
in interface Iterable<E>
iterator
in interface Collection<E>
iterator
in class AbstractCollection<E>
public String toString()
toString
in class AbstractCollection<E>
public long currentProducerIndex()
QueueProgressIndicators
currentProducerIndex
in interface QueueProgressIndicators
public long currentConsumerIndex()
QueueProgressIndicators
currentConsumerIndex
in interface QueueProgressIndicators
protected final void soNext(E[] curr, E[] next)
protected final E[] lvNextArrayAndUnlink(E[] curr)
public boolean offer(E e)
This implementation is correct for single producer thread use only.
protected final void linkOldToNew(long currIndex, E[] oldBuffer, long offset, E[] newBuffer, long offsetInNew, E e)
protected final void writeToQueue(E[] buffer, E e, long index, long offset)
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.
public final int size()
size
in interface Collection<E>
size
in class AbstractCollection<E>
public final boolean isEmpty()
isEmpty
in interface Collection<E>
isEmpty
in class AbstractCollection<E>
Copyright © 2013–2018. All rights reserved.