Class SpscUnboundedArrayQueue<E>

    • Field Detail

      • consumerIndex

        protected long consumerIndex
      • consumerMask

        protected long consumerMask
      • consumerBuffer

        protected E[] consumerBuffer
      • producerLookAheadStep

        protected int producerLookAheadStep
      • producerLookAhead

        protected long producerLookAhead
      • producerMask

        protected long producerMask
      • producerBuffer

        protected E[] producerBuffer
      • producerIndex

        protected long producerIndex
    • Constructor Detail

      • SpscUnboundedArrayQueue

        public SpscUnboundedArrayQueue(int bufferSize)
    • Method Detail

      • iterator

        public final Iterator<E> iterator()
      • offer

        public final boolean offer(E e)

        This implementation is correct for single producer thread use only.

      • poll

        public final E poll()

        This implementation is correct for single consumer thread use only.

      • peek

        public final E peek()

        This implementation is correct for single consumer thread use only.

      • size

        public final int size()
      • currentProducerIndex

        public long currentProducerIndex()
        Description copied from interface: QueueProgressIndicators
        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.
        Specified by:
        currentProducerIndex in interface  QueueProgressIndicators
        Returns:
        the current value of the producer progress index
      • currentConsumerIndex

        public long currentConsumerIndex()
        Description copied from interface: QueueProgressIndicators
        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.
        Specified by:
        currentConsumerIndex in interface  QueueProgressIndicators
        Returns:
        the current value of the consumer progress index