Additional top-level classes in compilation unit: MpUnboundedXaddArrayQueuePad1, MpUnboundedXaddArrayQueueProducerFields, MpUnboundedXaddArrayQueuePad2, MpUnboundedXaddArrayQueueProducerChunk, MpUnboundedXaddArrayQueuePad3, MpUnboundedXaddArrayQueueConsumerFields, MpUnboundedXaddArrayQueuePad5.
Modifier and Type | Field and Description |
---|---|
pack-priv final int | |
pack-priv final int | |
pack-priv final SpscArrayQueue | |
pack-priv final int | |
private static final long |
Access | Constructor and Description |
---|---|
pack-priv | MpUnboundedXaddArrayQueue(int
The buffer size to be used in each chunk of this queue chunkSize, int The maximum number of reused chunks kept around to avoid allocation, chunks are pre-allocated maxPooledChunks)
|
Modifier and Type | Method and Description |
---|---|
private R | |
public int | |
public final 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 void | fill(MessagePassingQueue.
Implements io. |
public boolean | isEmpty()
Overrides java. Implements io. |
public Iterator | iterator()
Implements abstract java. Implements java. |
public final int | |
pack-priv final void | moveToNextConsumerChunk(R cChunk, R next)
Does not null out the first element of `next`, callers must do that |
pack-priv abstract R | |
private R | |
pack-priv final R | Returns: the chunk matching the required indexthe starting point chunk, which does not match the required chunk index initialChunk, final long the chunk index we need requiredChunkIndex)We're here because currentChunk.index doesn't match the expectedChunkIndex. |
public boolean | relaxedOffer(E
not e)null , will throw NPE if it isImplements io. |
public int | size()
Implements abstract java. Implements io. |
public String | toString()
Overrides java. |
chunkMask | back to summary |
---|---|
pack-priv final int chunkMask |
chunkShift | back to summary |
---|---|
pack-priv final int chunkShift |
freeChunksPool | back to summary |
---|---|
pack-priv final SpscArrayQueue<R> freeChunksPool |
maxPooledChunks | back to summary |
---|---|
pack-priv final int maxPooledChunks |
ROTATION | back to summary |
---|---|
private static final long ROTATION |
MpUnboundedXaddArrayQueue | back to summary |
---|---|
pack-priv MpUnboundedXaddArrayQueue(int chunkSize, int maxPooledChunks)
|
appendNextChunks | back to summary |
---|---|
private R appendNextChunks(R currentChunk, long currentChunkIndex, long chunksToAppend) |
capacity | back to summary |
---|---|
public int capacity() Implements io.
|
chunkSize | back to summary |
---|---|
public final int chunkSize() |
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 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
|
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. Doc from java. Returns an iterator over the elements in this collection. There are no guarantees concerning the order in which the elements are returned (unless this collection is an instance of some class that provides a guarantee). |
maxPooledChunks | back to summary |
---|---|
public final int maxPooledChunks() |
moveToNextConsumerChunk | back to summary |
---|---|
pack-priv final void moveToNextConsumerChunk(R cChunk, R next) Does not null out the first element of `next`, callers must do that |
newChunk | back to summary |
---|---|
pack-priv abstract R newChunk(long index, R prev, int chunkSize, boolean pooled) |
newOrPooledChunk | back to summary |
---|---|
private R newOrPooledChunk(R prevChunk, long nextChunkIndex) |
producerChunkForIndex | back to summary |
---|---|
pack-priv final R producerChunkForIndex(final R initialChunk, final long requiredChunkIndex) We're here because currentChunk.index doesn't match the expectedChunkIndex. To resolve we must now chase the linked chunks to the appropriate chunk. More than one producer may end up racing to add or discover new chunks.
|
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
|
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
( |