Top Description Inners Fields Constructors Methods
io.netty.util.internal.shaded.org.jctools.queues

pack-priv abstract Class ConcurrentCircularArrayQueue<E>

Additional top-level class in compilation unit: ConcurrentCircularArrayQueueL0Pad.

extends ConcurrentCircularArrayQueueL0Pad<E>
implements MessagePassingQueue<E>, IndexedQueue, QueueProgressIndicators, SupportsIterator
Class Inheritance
All Implemented Interfaces
io.netty.util.internal.shaded.org.jctools.queues.SupportsIterator, io.netty.util.internal.shaded.org.jctools.queues.QueueProgressIndicators, io.netty.util.internal.shaded.org.jctools.queues.IndexedQueueSizeUtil.IndexedQueue, io.netty.util.internal.shaded.org.jctools.queues.MessagePassingQueue
Known Direct Subclasses
io.netty.util.internal.shaded.org.jctools.queues.ConcurrentSequencedCircularArrayQueue, io.netty.util.internal.shaded.org.jctools.queues.MpscArrayQueueL1Pad, io.netty.util.internal.shaded.org.jctools.queues.SpmcArrayQueueL1Pad, io.netty.util.internal.shaded.org.jctools.queues.SpscArrayQueueColdField
Imports
io.netty.util.internal.shaded.org.jctools.queues.IndexedQueueSizeUtil.IndexedQueue, io.netty.util.internal.shaded.org.jctools.util.Pow2, java.util.AbstractQueue, .Iterator, .NoSuchElementException

Common functionality for array backed queues. The class is pre-padded and the array is padded on either side to help with False Sharing prevention. It is expected that subclasses handle post padding.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
protected final E[]
protected final long
Inherited from io.netty.util.internal.shaded.org.jctools.queues.ConcurrentCircularArrayQueueL0Pad:
b000b001b002b003b004b005b006b007b010b011b012b013b014b015b016b017b020b021b022b023b024b025b026b027b030b031b032b033b034b035b036b037b040b041b042b043b044b045b046b047b050b051b052b053b054b055b056b057b060b061b062b063b064b065b066b067b070b071b072b073b074b075b076b077b100b101b102b103b104b105b106b107b110b111b112b113b114b115b116b117b120b121b122b123b124b125b126b127b130b131b132b133b134b135b136b137b140b141b142b143b144b145b146b147b150b151b152b153b154b155b156b157b160b161b162b163b164b165b166b167b170b171b172b173b174b175b176b177

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public int
public void
public long
public long
public boolean
isEmpty()

Overrides java.util.AbstractCollection.isEmpty.

Implements io.netty.util.internal.shaded.org.jctools.queues.MessagePassingQueue.isEmpty, java.util.Collection.isEmpty.

This method's accuracy is subject to concurrent modifications happening as the observation is carried out.
public Iterator<E>

Returns:

The iterator.
iterator
()

Implements abstract java.util.AbstractCollection.iterator.

Implements java.util.Collection.iterator.

Get an iterator for this queue.
public int
size()

Implements abstract java.util.AbstractCollection.size.

Implements io.netty.util.internal.shaded.org.jctools.queues.MessagePassingQueue.size, java.util.Collection.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.
public String
toString()

Overrides java.util.AbstractCollection.toString.

Returns a string representation of this collection.

Field Detail

bufferback to summary
protected final E[] buffer
maskback to summary
protected final long mask

Constructor Detail

ConcurrentCircularArrayQueueback to summary
pack-priv ConcurrentCircularArrayQueue(int capacity)

Method Detail

capacityback to summary
public int capacity()

Implements io.netty.util.internal.shaded.org.jctools.queues.MessagePassingQueue.capacity, io.netty.util.internal.shaded.org.jctools.queues.IndexedQueueSizeUtil.IndexedQueue.capacity.

Returns:int

Doc from io.netty.util.internal.shaded.org.jctools.queues.MessagePassingQueue.capacity.

the capacity of this queue or MessagePassingQueue#UNBOUNDED_CAPACITY if not bounded

Annotations
@Override
clearback to summary
public void clear()

Overrides java.util.AbstractQueue.clear.

Implements io.netty.util.internal.shaded.org.jctools.queues.MessagePassingQueue.clear, java.util.Collection.clear.

Doc from io.netty.util.internal.shaded.org.jctools.queues.MessagePassingQueue.clear.

Removes all items from the queue. Called from the consumer thread subject to the restrictions appropriate to the implementation and according to the Queue#clear() interface.

Annotations
@Override
currentConsumerIndexback to summary
public long currentConsumerIndex()

Implements io.netty.util.internal.shaded.org.jctools.queues.QueueProgressIndicators.currentConsumerIndex.

Doc from io.netty.util.internal.shaded.org.jctools.queues.QueueProgressIndicators.currentConsumerIndex.

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.
This value will normally indicate number of elements taken out of the queue, but may under some circumstances be a derivative of that figure. This method should not be used to derive size or emptiness.

Returns:long

the current value of the consumer progress index

Annotations
@Override
currentProducerIndexback to summary
public long currentProducerIndex()

Implements io.netty.util.internal.shaded.org.jctools.queues.QueueProgressIndicators.currentProducerIndex.

Doc from io.netty.util.internal.shaded.org.jctools.queues.QueueProgressIndicators.currentProducerIndex.

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.
This value will normally indicate number of elements passed into the queue, but may under some circumstances be a derivative of that figure. This method should not be used to derive size or emptiness.

Returns:long

the current value of the producer progress index

Annotations
@Override
isEmptyback to summary
public boolean isEmpty()

Overrides java.util.AbstractCollection.isEmpty.

Implements io.netty.util.internal.shaded.org.jctools.queues.MessagePassingQueue.isEmpty, java.util.Collection.isEmpty.

Doc from io.netty.util.internal.shaded.org.jctools.queues.MessagePassingQueue.isEmpty.

This method's accuracy is subject to concurrent modifications happening as the observation is carried out.

Returns:boolean

true if empty, false otherwise

Annotations
@Override
iteratorback to summary
public Iterator<E> iterator()

Implements abstract java.util.AbstractCollection.iterator.

Implements java.util.Collection.iterator.

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.

Returns:Iterator<E>

The iterator.

Annotations
@Override
sizeback to summary
public int size()

Implements abstract java.util.AbstractCollection.size.

Implements io.netty.util.internal.shaded.org.jctools.queues.MessagePassingQueue.size, java.util.Collection.size.

Doc from io.netty.util.internal.shaded.org.jctools.queues.MessagePassingQueue.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. For some implementations this method may be O(n) rather than O(1).

Returns:int

number of messages in the queue, between 0 and Integer#MAX_VALUE but less or equals to capacity (if bounded).

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.util.AbstractCollection.toString.

Doc from java.util.AbstractCollection.toString.

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 ("[]"). Adjacent elements are separated by the characters ", " (comma and space). Elements are converted to strings as by String#valueOf(Object).

Returns:String

a string representation of this collection

Annotations
@Override
io.netty.util.internal.shaded.org.jctools.queues back to summary

private Class ConcurrentCircularArrayQueue.WeakIterator<E>

extends Object
implements Iterator<E>
Class Inheritance
  • java.lang.Object
  • io.netty.util.internal.shaded.org.jctools.queues.ConcurrentCircularArrayQueue.WeakIterator
All Implemented Interfaces
java.util.Iterator

Field Summary

Modifier and TypeField and Description
private final E[]
private final long
private E
private long
private final long

Constructor Summary

AccessConstructor and Description
pack-priv
WeakIterator(long cIndex, long pIndex, long mask, E[] buffer)

Method Summary

Modifier and TypeMethod and Description
private E
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.
public E
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.
public void
remove()

Overrides default java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation).
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bufferback to summary
private final E[] buffer
maskback to summary
private final long mask
nextElementback to summary
private E nextElement
nextIndexback to summary
private long nextIndex
pIndexback to summary
private final long pIndex

Constructor Detail

WeakIteratorback to summary
pack-priv WeakIterator(long cIndex, long pIndex, long mask, E[] buffer)

Method Detail

getNextback to summary
private E getNext()
hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Returns:boolean

true if the iteration has more elements

Annotations
@Override
nextback to summary
public E next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Returns:E

the next element in the iteration

Annotations
@Override
removeback to summary
public void remove()

Overrides default java.util.Iterator.remove.

Doc from java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation). This method can be called only once per call to next.

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 forEachRemaining method.

Annotations
@Override