Class FullDrainMpscQueue<T>

  • All Implemented Interfaces:
    MpscQueue<T>

    public class FullDrainMpscQueue<T>
    extends java.lang.Object
    implements MpscQueue<T>
    • Constructor Summary

      Constructors 
      Constructor Description
      FullDrainMpscQueue​(int capacity)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int capacity()  
      void drain​(org.jctools.queues.MessagePassingQueue.Consumer<T> consumer)
      The MpscArrayQueue.drain(MessagePassingQueue.Consumer) method may skip items with allocated slots by producers (who won CAS) but were not added to the queue yet.
      boolean offer​(T element)  
      int size()  
      • Methods inherited from class java.lang.Object

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

      • FullDrainMpscQueue

        public FullDrainMpscQueue​(int capacity)
    • Method Detail

      • offer

        public boolean offer​(T element)
        Specified by:
        offer in interface MpscQueue<T>
      • drain

        public void drain​(org.jctools.queues.MessagePassingQueue.Consumer<T> consumer)
        The MpscArrayQueue.drain(MessagePassingQueue.Consumer) method may skip items with allocated slots by producers (who won CAS) but were not added to the queue yet. This may happen to broken elements chain. See explanation at http://psy-lob-saw.blogspot.com/2014/07/poll-me-maybe.html This is an alternative approach which waits for all items to become available by using MpscArrayQueue.poll() underneath (which spin-waits when getting next item).
        Specified by:
        drain in interface MpscQueue<T>
      • size

        public int size()
        Specified by:
        size in interface MpscQueue<T>