Additional top-level classes in compilation unit: BaseMpscLinkedArrayQueuePad1, BaseMpscLinkedArrayQueueProducerFields, BaseMpscLinkedArrayQueuePad2, BaseMpscLinkedArrayQueueConsumerFields, BaseMpscLinkedArrayQueuePad3, BaseMpscLinkedArrayQueueColdProducerFields.
Modifier and Type | Class and Description |
---|---|
private static class |
Modifier and Type | Field and Description |
---|---|
private static final Object | |
private static final int | |
private static final Object | |
private static final int | |
private static final int | |
private static final int |
Access | Constructor and Description |
---|---|
public | BaseMpscLinkedArrayQueue(final int
the queue initial capacity. If chunk size is fixed this will be the chunk size.
Must be 2 or more. initialCapacity)
|
Modifier and Type | Method and Description |
---|---|
protected abstract long | |
public abstract int | |
public long | currentConsumerIndex()
Implements io. |
public long | currentProducerIndex()
Implements io. |
public int | drain(MessagePassingQueue.
Implements io. |
public int | drain(MessagePassingQueue.
Implements io. |
public void | drain(MessagePassingQueue.
Implements io. |
public int | fill(MessagePassingQueue.
Implements io. |
public int | fill(MessagePassingQueue.
Implements io. |
public void | fill(MessagePassingQueue.
Implements io. |
protected abstract long | Returns: current buffer capacity for elements (excluding next pointer and jump entry) * 2
|
protected abstract int | |
public boolean | isEmpty()
Overrides java. Implements io. |
public Iterator | Returns: The iterator.Implements abstract java. Implements java. |
private E | |
private E | |
private static long | |
private E[] | |
public boolean | offer(final E
not e)null , will throw NPE if it isImplements io. Queue#offer(Object) interface.
|
private int | offerSlowPath(long mask, long pIndex, long producerLimit)
We do not inline resize into this method because we do not resize on fill. |
public E | peek()
Implements io. Queue#peek() interface.
|
public E | poll()
Implements io. Queue#poll() interface.
|
public boolean | relaxedOffer(E
not e)null , will throw NPE if it isImplements io. |
public E | relaxedPeek()
Implements io. |
public E | relaxedPoll()
Implements io. |
private void | |
public int | size()
Implements abstract java. Implements io. |
public String | toString()
Overrides java. |
BUFFER_CONSUMED | back to summary |
---|---|
private static final Object BUFFER_CONSUMED |
CONTINUE_TO_P_INDEX_CAS | back to summary |
---|---|
private static final int CONTINUE_TO_P_INDEX_CAS |
JUMP | back to summary |
---|---|
private static final Object JUMP |
QUEUE_FULL | back to summary |
---|---|
private static final int QUEUE_FULL |
QUEUE_RESIZE | back to summary |
---|---|
private static final int QUEUE_RESIZE |
RETRY | back to summary |
---|---|
private static final int RETRY |
BaseMpscLinkedArrayQueue | back to summary |
---|---|
public BaseMpscLinkedArrayQueue(final int initialCapacity)
|
availableInQueue | back to summary |
---|---|
protected abstract long availableInQueue(long pIndex, long cIndex)
|
capacity | back to summary |
---|---|
public abstract int capacity() Redeclares io.
|
currentConsumerIndex | back to summary |
---|---|
public long currentConsumerIndex() Implements io. Doc from io. This method has no concurrent visibility semantics. The value returned may be negative. Under normal
circumstances 2 consecutive calls to this method can offer an idea of progress made by consumer threads
by subtracting the 2 results though in extreme cases (if consumers have progressed by more than 2^64)
this may also fail.
|
currentProducerIndex | back to summary |
---|---|
public long currentProducerIndex() Implements io. Doc from io. This method has no concurrent visibility semantics. The value returned may be negative. Under normal
circumstances 2 consecutive calls to this method can offer an idea of progress made by producer threads
by subtracting the 2 results though in extreme cases (if producers have progressed by more than 2^64)
this may also fail.
|
drain | back to summary |
---|---|
public int drain(MessagePassingQueue. Implements io. Doc from io. Remove all available item from the queue and hand to consume. This should be semantically similar to: M m; while((m = relaxedPoll()) != null){ c.accept(m); }There's no strong commitment to the queue being empty at the end of a drain. Called from a consumer thread subject to the restrictions appropriate to the implementation. Warning Explicit assumptions are made with regards to
|
drain | back to summary |
---|---|
public int drain(MessagePassingQueue. Implements io. Doc from io. Remove up to limit elements from the queue and hand to consume. This should be semantically similar to:
There's no strong commitment to the queue being empty at the end of a drain. Called from a consumer thread subject to the restrictions appropriate to the implementation. Warning Explicit assumptions are made with regards to
|
drain | back to summary |
---|---|
public void drain(MessagePassingQueue. Implements io. Doc from io. Remove elements from the queue and hand to consume forever. Semantically similar to:
int idleCounter = 0; while (exit.keepRunning()) { E e = relaxedPoll(); if(e==null){ idleCounter = wait.idle(idleCounter); continue; } idleCounter = 0; c.accept(e); } Called from a consumer thread subject to the restrictions appropriate to the implementation. Warning Explicit assumptions are made with regards to
|
fill | back to summary |
---|---|
public int fill(MessagePassingQueue. Implements io. Doc from io. Stuff the queue with elements from the supplier. Semantically similar to: while(relaxedOffer(s.get());There's no strong commitment to the queue being full at the end of a fill. Called from a producer thread subject to the restrictions appropriate to the implementation. Unbounded queues will fill up the queue with a fixed amount rather than fill up to oblivion Warning Explicit assumptions are made with regards to
|
fill | back to summary |
---|---|
public int fill(MessagePassingQueue. Implements io. Doc from io. Stuff the queue with up to limit elements from the supplier. Semantically similar to:
There's no strong commitment to the queue being full at the end of a fill. Called from a producer thread subject to the restrictions appropriate to the implementation Warning Explicit assumptions are made with regards to
|
fill | back to summary |
---|---|
public void fill(MessagePassingQueue. Implements io. Doc from io. Stuff the queue with elements from the supplier forever. Semantically similar to:
Called from a producer thread subject to the restrictions appropriate to the implementation. The main difference
being that implementors MUST assure room in the queue is available BEFORE calling Warning Explicit assumptions are made with regards to
|
getCurrentBufferCapacity | back to summary |
---|---|
protected abstract long getCurrentBufferCapacity(long mask)
|
getNextBufferSize | back to summary |
---|---|
protected abstract int getNextBufferSize(E[] buffer)
|
isEmpty | back to summary |
---|---|
public boolean isEmpty() Overrides java. Implements io. Doc from io. This method's accuracy is subject to concurrent modifications happening as the observation is carried out.
|
iterator | back to summary |
---|---|
public Iterator Implements abstract java. Implements java. Get an iterator for this queue. This method is thread safe. 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. |
newBufferPeek | back to summary |
---|---|
private E newBufferPeek(E[] nextBuffer, long index) |
newBufferPoll | back to summary |
---|---|
private E newBufferPoll(E[] nextBuffer, long index) |
nextArrayOffset | back to summary |
---|---|
private static long nextArrayOffset(long mask) |
nextBuffer | back to summary |
---|---|
private E[] nextBuffer(final E[] buffer, final long mask)
|
offer | back to summary |
---|---|
public boolean offer(final E e) Implements io. Doc from io. Called from a producer thread subject to the restrictions appropriate to the implementation and
according to the
|
offerSlowPath | back to summary |
---|---|
private int offerSlowPath(long mask, long pIndex, long producerLimit) We do not inline resize into this method because we do not resize on fill. |
peek | back to summary |
---|---|
public E peek() Implements io. Doc from io. Called from the consumer thread subject to the restrictions appropriate to the implementation and
according to the This implementation is correct for single consumer thread use only.
|
poll | back to summary |
---|---|
public E poll() Implements io. Doc from io. Called from the consumer thread subject to the restrictions appropriate to the implementation and
according to the This implementation is correct for single consumer thread use only.
|
relaxedOffer | back to summary |
---|---|
public boolean relaxedOffer(E e) Implements io. Doc from io. Called from a producer thread subject to the restrictions appropriate to the implementation. As opposed
to
|
relaxedPeek | back to summary |
---|---|
public E relaxedPeek() Implements io. Doc from io. Called from the consumer thread subject to the restrictions appropriate to the implementation. As
opposed to
|
relaxedPoll | back to summary |
---|---|
public E relaxedPoll() Implements io. Doc from io. Called from the consumer thread subject to the restrictions appropriate to the implementation. As
opposed to
|
resize | back to summary |
---|---|
private void resize(long oldMask, E[] oldBuffer, long pIndex, E e, MessagePassingQueue. |
size | back to summary |
---|---|
public int size() Implements abstract java. Implements io. Doc from io. 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. For some implementations this method may be O(n) rather than O(1).
|
toString | back to summary |
---|---|
public String toString() Overrides java. Doc from java. Returns a string representation of this collection. The string
representation consists of a list of the collection's elements in the
order they are returned by its iterator, enclosed in square brackets
( |
Modifier and Type | Field and Description |
---|---|
private E[] | |
private int | |
private E | |
private long | |
private final long |
Access | Constructor and Description |
---|---|
pack-priv |
Modifier and Type | Method and Description |
---|---|
private E | |
public boolean | |
public E | |
public void | remove()
Overrides default java. |
private void |
currentBuffer | back to summary |
---|---|
private E[] currentBuffer |
mask | back to summary |
---|---|
private int mask |
nextElement | back to summary |
---|---|
private E nextElement |
nextIndex | back to summary |
---|---|
private long nextIndex |
pIndex | back to summary |
---|---|
private final long pIndex |
WeakIterator | back to summary |
---|---|
pack-priv WeakIterator(E[] currentBuffer, long cIndex, long pIndex) |
getNext | back to summary |
---|---|
private E getNext() |
hasNext | back to summary |
---|---|
public boolean hasNext() Implements java. Doc from java. Returns
|
next | back to summary |
---|---|
public E next() Implements java. Doc from java. Returns the next element in the iteration.
|
remove | back to summary |
---|---|
public void remove() Overrides default java. Doc from java. Removes from the underlying collection the last element returned
by this iterator (optional operation). This method can be called
only once per call to The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.
The behavior of an iterator is unspecified if this method is called
after a call to the
|
setBuffer | back to summary |
---|---|
private void setBuffer(E[] buffer) |