abstract class AtomicReferenceArrayQueue<E> extends java.util.AbstractQueue<E> implements IndexedQueueSizeUtil.IndexedQueue, QueueProgressIndicators, MessagePassingQueue<E>, SupportsIterator
| Modifier and Type | Class and Description |
|---|---|
private static class |
AtomicReferenceArrayQueue.WeakIterator<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 |
|---|---|
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()
Get an iterator for this queue.
|
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.
|
java.lang.String |
toString() |
contains, containsAll, remove, removeAll, retainAll, toArray, toArrayclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitlvConsumerIndex, lvProducerIndexdrain, drain, drain, fill, fill, fill, offer, peek, poll, relaxedOffer, relaxedPeek, relaxedPollprotected final java.util.concurrent.atomic.AtomicReferenceArray<E> buffer
protected final int mask
public java.lang.String toString()
toString in class java.util.AbstractCollection<E>public void clear()
MessagePassingQueueCollection.clear() interface.clear in interface java.util.Collection<E>clear in interface MessagePassingQueue<E>clear in class java.util.AbstractQueue<E>public final int capacity()
capacity in interface IndexedQueueSizeUtil.IndexedQueuecapacity 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()
MessagePassingQueueisEmpty in interface java.util.Collection<E>isEmpty in interface MessagePassingQueue<E>isEmpty in class java.util.AbstractCollection<E>public final long currentProducerIndex()
QueueProgressIndicatorscurrentProducerIndex in interface QueueProgressIndicatorspublic final long currentConsumerIndex()
QueueProgressIndicatorscurrentConsumerIndex in interface QueueProgressIndicatorspublic final java.util.Iterator<E> iterator()
The iterator provides a best-effort snapshot of the elements in the queue. The returned iterator is not guaranteed to return elements in queue order, and races with the consumer thread may cause gaps in the sequence of returned elements. Like {link #relaxedPoll}, the iterator may not immediately return newly inserted elements.