Class SpscExactAtomicArrayQueue<T>

  • All Implemented Interfaces:
    Serializable, Iterable<T>, Collection<T>, Queue<T>


    public final class SpscExactAtomicArrayQueue<T>
    extends AtomicReferenceArray<T>
    implements Queue<T>
    A single-producer single-consumer bounded queue with exact capacity tracking.

    This means that a queue of 10 will allow exactly 10 offers, however, the underlying storage is still power-of-2.

    The implementation uses field updaters and thus should be platform-safe.

    See Also:
    Serialized Form
    • Constructor Detail

      • SpscExactAtomicArrayQueue

        public SpscExactAtomicArrayQueue(int capacity)
    • Method Detail

      • offer

        public boolean offer(T value)
      • poll

        public T poll()
      • peek

        public T peek()
      • clear

        public void clear()
      • isEmpty

        public boolean isEmpty()
      • size

        public int size()
      • contains

        public boolean contains(Object o)
      • toArray

        public Object[] toArray()
      • toArray

        public <E> E[] toArray(E[] a)
      • remove

        public boolean remove(Object o)
      • containsAll

        public boolean containsAll(Collection<?> c)
      • addAll

        public boolean addAll(Collection<? extends T> c)
      • removeAll

        public boolean removeAll(Collection<?> c)
      • retainAll

        public boolean retainAll(Collection<?> c)
      • add

        public boolean add(T e)
      • remove

        public T remove()
      • element

        public T element()