Package 

Class SpscAtomicArrayQueue

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

    
    public final class SpscAtomicArrayQueue<E>
    extends AtomicReferenceArrayQueue<E>
                        

    A Single-Producer-Single-Consumer queue backed by a pre-allocated buffer.

    This implementation is a mashup of the Fast Flowalgorithm with an optimization of the offer method taken from the BQueue algorithm (a variation on Fast Flow), and adjusted to comply with Queue.offer semantics with regards to capacity.For convenience the relevant papers are available in the resources folder:2010 - Pisa - SPSC Queues on Shared Cache Multi-Core Systems.pdf2012 - Junchang- BQueue- Efficient and Practical Queuing.pdf This implementation is wait free.

    • Method Summary

      Modifier and Type Method Description
      boolean offer(E e)
      E poll()
      E peek()
      int size()
      boolean isEmpty()
      • Methods inherited from class com.tds.common.reactor.internal.util.atomic.AtomicReferenceArrayQueue

        clear, iterator
      • Methods inherited from class java.util.AbstractQueue

        add, addAll, clear, element, remove
      • Methods inherited from class java.util.AbstractCollection

        contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray, toString
      • Methods inherited from class java.util.Collection

        parallelStream, removeIf, spliterator, stream
      • Methods inherited from class java.lang.Iterable

        forEach, iterator, spliterator
      • Methods inherited from class java.util.Queue

        offer, peek, poll
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SpscAtomicArrayQueue

        SpscAtomicArrayQueue(int capacity)