public abstract class AtomicReferenceArrayQueue<E> extends AbstractQueue<E> implements IndexedQueueSizeUtil.IndexedQueue, QueueProgressIndicators, MessagePassingQueue<E>, SupportsIterator
MessagePassingQueue.Consumer<T>, MessagePassingQueue.ExitCondition, MessagePassingQueue.Supplier<T>, MessagePassingQueue.WaitStrategy| Modifier and Type | Field and Description |
|---|---|
protected 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.
|
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.
|
String |
toString() |
add, addAll, element, removecontains, 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, relaxedPollcontains, containsAll, equals, hashCode, parallelStream, remove, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArrayprotected final AtomicReferenceArray<E> buffer
protected final int mask
public String toString()
toString in class AbstractCollection<E>public void clear()
MessagePassingQueueCollection.clear() interface.clear in interface Collection<E>clear in interface MessagePassingQueue<E>clear in class 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 Collection<E>size in interface MessagePassingQueue<E>size in class AbstractCollection<E>Integer.MAX_VALUE but less or equals to
capacity (if bounded).public final boolean isEmpty()
MessagePassingQueueisEmpty in interface Collection<E>isEmpty in interface MessagePassingQueue<E>isEmpty in class AbstractCollection<E>public final long currentProducerIndex()
QueueProgressIndicatorscurrentProducerIndex in interface QueueProgressIndicatorspublic final long currentConsumerIndex()
QueueProgressIndicatorscurrentConsumerIndex in interface QueueProgressIndicatorspublic final 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.
iterator in interface Iterable<E>iterator in interface Collection<E>iterator in class AbstractCollection<E>Copyright © 2013–2024. All rights reserved.