abstract class AtomicReferenceArrayQueue<E> extends java.util.AbstractQueue<E> implements IndexedQueueSizeUtil.IndexedQueue, QueueProgressIndicators, MessagePassingQueue<E>
MessagePassingQueue.Consumer<T>, MessagePassingQueue.ExitCondition, MessagePassingQueue.Supplier<T>, MessagePassingQueue.WaitStrategy
Modifier and Type | Field and Description |
---|---|
protected java.util.concurrent.atomic.AtomicReferenceArray<E> |
buffer |
protected int |
mask |
UNBOUNDED_CAPACITY
Constructor and Description |
---|
AtomicReferenceArrayQueue(int capacity) |
Modifier and Type | Method and Description |
---|---|
protected int |
calcElementOffset(long index) |
protected int |
calcElementOffset(long index,
int mask) |
int |
capacity() |
void |
clear()
Removes all items from the queue.
|
long |
currentConsumerIndex()
This method has no concurrent visibility semantics.
|
long |
currentProducerIndex()
This method has no concurrent visibility semantics.
|
boolean |
isEmpty()
This method's accuracy is subject to concurrent modifications happening as the observation is carried
out.
|
java.util.Iterator<E> |
iterator() |
static <E> E |
lpElement(java.util.concurrent.atomic.AtomicReferenceArray<E> buffer,
int offset) |
protected E |
lpElement(int offset) |
static <E> E |
lvElement(java.util.concurrent.atomic.AtomicReferenceArray<E> buffer,
int offset) |
protected E |
lvElement(int offset) |
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.
|
static <E> void |
soElement(java.util.concurrent.atomic.AtomicReferenceArray<E> buffer,
int offset,
E value) |
protected void |
soElement(int offset,
E value) |
static <E> void |
spElement(java.util.concurrent.atomic.AtomicReferenceArray<E> buffer,
int offset,
E value) |
protected void |
spElement(int offset,
E value) |
static <E> void |
svElement(java.util.concurrent.atomic.AtomicReferenceArray<E> buffer,
int offset,
E value) |
java.lang.String |
toString() |
contains, containsAll, remove, removeAll, retainAll, toArray, toArray
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
lvConsumerIndex, lvProducerIndex
drain, drain, drain, fill, fill, fill, offer, peek, poll, relaxedOffer, relaxedPeek, relaxedPoll
protected final java.util.concurrent.atomic.AtomicReferenceArray<E> buffer
protected final int mask
public java.util.Iterator<E> iterator()
public java.lang.String toString()
toString
in class java.util.AbstractCollection<E>
public void clear()
MessagePassingQueue
Collection.clear()
interface.clear
in interface java.util.Collection<E>
clear
in interface MessagePassingQueue<E>
clear
in class java.util.AbstractQueue<E>
protected final int calcElementOffset(long index, int mask)
protected final int calcElementOffset(long index)
public static <E> E lvElement(java.util.concurrent.atomic.AtomicReferenceArray<E> buffer, int offset)
public static <E> E lpElement(java.util.concurrent.atomic.AtomicReferenceArray<E> buffer, int offset)
protected final E lpElement(int offset)
public static <E> void spElement(java.util.concurrent.atomic.AtomicReferenceArray<E> buffer, int offset, E value)
protected final void spElement(int offset, E value)
public static <E> void soElement(java.util.concurrent.atomic.AtomicReferenceArray<E> buffer, int offset, E value)
protected final void soElement(int offset, E value)
public static <E> void svElement(java.util.concurrent.atomic.AtomicReferenceArray<E> buffer, int offset, E value)
protected final E lvElement(int offset)
public final int capacity()
capacity
in interface MessagePassingQueue<E>
MessagePassingQueue.UNBOUNDED_CAPACITY
if not boundedpublic final int size()
size
in interface java.util.Collection<E>
size
in interface MessagePassingQueue<E>
size
in class java.util.AbstractCollection<E>
Integer.MAX_VALUE
but less or equals to
capacity (if bounded).public final boolean isEmpty()
MessagePassingQueue
isEmpty
in interface java.util.Collection<E>
isEmpty
in interface MessagePassingQueue<E>
isEmpty
in class java.util.AbstractCollection<E>
public final long currentProducerIndex()
QueueProgressIndicators
currentProducerIndex
in interface QueueProgressIndicators
public final long currentConsumerIndex()
QueueProgressIndicators
currentConsumerIndex
in interface QueueProgressIndicators