Class MpscGrowableArrayQueue<E>

  • All Implemented Interfaces:
    java.lang.Iterable<E>, java.util.Collection<E>, java.util.Queue<E>

    final class MpscGrowableArrayQueue<E>
    extends MpscChunkedArrayQueue<E>
    An MPSC array queue which starts at initialCapacity and grows to maxCapacity in linked chunks of the initial size. The queue grows only when the current buffer is full and elements are not copied on resize, instead a link to the new buffer is stored in the old buffer for the consumer to follow.

    This is a shaded copy of MpscGrowableArrayQueue provided by JCTools from version 2.0.

    • Constructor Detail

      • MpscGrowableArrayQueue

        public MpscGrowableArrayQueue​(int initialCapacity,
                                      int maxCapacity)
        Parameters:
        initialCapacity - the queue initial capacity. If chunk size is fixed this will be the chunk size. Must be 2 or more.
        maxCapacity - the maximum capacity will be rounded up to the closest power of 2 and will be the upper limit of number of elements in this queue. Must be 4 or more and round up to a larger power of 2 than initialCapacity.
    • Method Detail

      • getCurrentBufferCapacity

        protected long getCurrentBufferCapacity​(long mask)
        Overrides:
        getCurrentBufferCapacity in class MpscChunkedArrayQueue<E>
        Returns:
        current buffer capacity for elements (excluding next pointer and jump entry) * 2