Class AbstractConcurrentArrayQueue<E>

    • Field Detail

      • TAIL_OFFSET

        protected static final long TAIL_OFFSET
        Offset of the tail field.
      • SHARED_HEAD_CACHE_OFFSET

        protected static final long SHARED_HEAD_CACHE_OFFSET
        Offset of the sharedHeadCache field.
      • HEAD_OFFSET

        protected static final long HEAD_OFFSET
        Offset of the head field.
      • BUFFER_ARRAY_BASE

        protected static final int BUFFER_ARRAY_BASE
        Array base.
      • SHIFT_FOR_SCALE

        protected static final int SHIFT_FOR_SCALE
        Shift for scale.
      • capacity

        protected final int capacity
        Queue capacity.
      • buffer

        protected final E[] buffer
        Backing array.
    • Constructor Detail

      • AbstractConcurrentArrayQueue

        public AbstractConcurrentArrayQueue​(int requestedCapacity)
        Constructs a queue with the requested capacity.
        Parameters:
        requestedCapacity - of the queue.
    • Method Detail

      • addedCount

        public long addedCount()
        The number of items added to this container since creation.
        Specified by:
        addedCount in interface Pipe<E>
        Returns:
        the number of items added.
      • removedCount

        public long removedCount()
        The number of items removed from this container since creation.
        Specified by:
        removedCount in interface Pipe<E>
        Returns:
        the number of items removed.
      • capacity

        public int capacity()
        The maximum capacity of this container to hold items.
        Specified by:
        capacity in interface Pipe<E>
        Returns:
        the capacity of the container.
      • remainingCapacity

        public int remainingCapacity()
        Get the remaining capacity for elements in the container given the current size.
        Specified by:
        remainingCapacity in interface Pipe<E>
        Returns:
        remaining capacity of the container.
      • peek

        public E peek()
        Specified by:
        peek in interface java.util.Queue<E>
      • add

        public boolean add​(E e)
        Specified by:
        add in interface java.util.Collection<E>
        Specified by:
        add in interface java.util.Queue<E>
      • remove

        public E remove()
        Specified by:
        remove in interface java.util.Queue<E>
      • element

        public E element()
        Specified by:
        element in interface java.util.Queue<E>
      • contains

        public boolean contains​(java.lang.Object o)
        Specified by:
        contains in interface java.util.Collection<E>
      • iterator

        public java.util.Iterator<E> iterator()
        Specified by:
        iterator in interface java.util.Collection<E>
        Specified by:
        iterator in interface java.lang.Iterable<E>
      • toArray

        public java.lang.Object[] toArray()
        Specified by:
        toArray in interface java.util.Collection<E>
      • toArray

        public <T> T[] toArray​(T[] a)
        Specified by:
        toArray in interface java.util.Collection<E>
      • remove

        public boolean remove​(java.lang.Object o)
        Specified by:
        remove in interface java.util.Collection<E>
      • containsAll

        public boolean containsAll​(java.util.Collection<?> c)
        Specified by:
        containsAll in interface java.util.Collection<E>
      • addAll

        public boolean addAll​(java.util.Collection<? extends E> c)
        Specified by:
        addAll in interface java.util.Collection<E>
      • removeAll

        public boolean removeAll​(java.util.Collection<?> c)
        Specified by:
        removeAll in interface java.util.Collection<E>
      • retainAll

        public boolean retainAll​(java.util.Collection<?> c)
        Specified by:
        retainAll in interface java.util.Collection<E>
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Collection<E>
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface java.util.Collection<E>
      • size

        public int size()
        The number of items currently in the container.
        Specified by:
        size in interface java.util.Collection<E>
        Specified by:
        size in interface Pipe<E>
        Returns:
        number of items currently in the container.
      • sequenceToBufferOffset

        public static long sequenceToBufferOffset​(long sequence,
                                                  long mask)
        Compute buffer offset based on the given sequence and the mask.
        Parameters:
        sequence - to compute the offset from.
        mask - to apply.
        Returns:
        buffer offset.