E
- public abstract class ConcurrentCircularArrayQueue<E> extends AbstractQueue<E>
MessagePassingQueue.Consumer<T>, MessagePassingQueue.ExitCondition, MessagePassingQueue.Supplier<T>, MessagePassingQueue.WaitStrategy
Modifier and Type | Field and Description |
---|---|
protected E[] |
buffer |
protected long |
mask |
UNBOUNDED_CAPACITY
Constructor and Description |
---|
ConcurrentCircularArrayQueue(int capacity) |
Modifier and Type | Method and Description |
---|---|
protected long |
calcElementOffset(long index) |
protected static long |
calcElementOffset(long index,
long 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.
|
Iterator<E> |
iterator() |
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, remove
contains, containsAll, remove, removeAll, retainAll, toArray, toArray
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
drain, drain, drain, fill, fill, fill, offer, peek, poll, relaxedOffer, relaxedPeek, relaxedPoll
lvConsumerIndex, lvProducerIndex
contains, containsAll, equals, hashCode, parallelStream, remove, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray
protected final long mask
protected final E[] buffer
protected static long calcElementOffset(long index, long mask)
index
- desirable element indexmask
- (length - 1)protected final long calcElementOffset(long index)
index
- desirable element indexpublic Iterator<E> iterator()
iterator
in interface Iterable<E>
iterator
in interface Collection<E>
iterator
in class AbstractCollection<E>
public final int size()
MessagePassingQueue
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()
MessagePassingQueue
isEmpty
in interface Collection<E>
isEmpty
in interface MessagePassingQueue<E>
isEmpty
in class AbstractCollection<E>
public String toString()
toString
in class AbstractCollection<E>
public void clear()
MessagePassingQueue
Collection.clear()
interface.clear
in interface Collection<E>
clear
in interface MessagePassingQueue<E>
clear
in class AbstractQueue<E>
public int capacity()
MessagePassingQueue.UNBOUNDED_CAPACITY
if not boundedpublic final long currentProducerIndex()
QueueProgressIndicators
public final long currentConsumerIndex()
QueueProgressIndicators
Copyright © 2013–2018. All rights reserved.