public class SpscUnboundedAtomicArrayQueue<E> extends AbstractQueue<E> implements QueueProgressIndicators
Modifier and Type | Field and Description |
---|---|
protected AtomicReferenceArray<Object> |
consumerBuffer |
protected AtomicLong |
consumerIndex |
protected int |
consumerMask |
protected AtomicReferenceArray<Object> |
producerBuffer |
protected AtomicLong |
producerIndex |
protected long |
producerLookAhead |
protected int |
producerLookAheadStep |
protected int |
producerMask |
Constructor and Description |
---|
SpscUnboundedAtomicArrayQueue(int bufferSize) |
Modifier and Type | Method and Description |
---|---|
long |
currentConsumerIndex()
This method has no concurrent visibility semantics.
|
long |
currentProducerIndex()
This method has no concurrent visibility semantics.
|
Iterator<E> |
iterator() |
boolean |
offer(E e) |
E |
peek() |
E |
poll() |
int |
size() |
contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
contains, containsAll, equals, hashCode, isEmpty, parallelStream, remove, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray
protected final AtomicLong producerIndex
protected int producerLookAheadStep
protected long producerLookAhead
protected int producerMask
protected AtomicReferenceArray<Object> producerBuffer
protected int consumerMask
protected AtomicReferenceArray<Object> consumerBuffer
protected final AtomicLong consumerIndex
public SpscUnboundedAtomicArrayQueue(int bufferSize)
public final Iterator<E> iterator()
iterator
in interface Iterable<E>
iterator
in interface Collection<E>
iterator
in class AbstractCollection<E>
public final boolean offer(E e)
This implementation is correct for single producer thread use only.
public final E poll()
This implementation is correct for single consumer thread use only.
public final 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 long currentProducerIndex()
QueueProgressIndicators
currentProducerIndex
in interface QueueProgressIndicators
public long currentConsumerIndex()
QueueProgressIndicators
currentConsumerIndex
in interface QueueProgressIndicators
Copyright © 2013-2016. All Rights Reserved.