Class JCToolsBlockingQueueFactory.MpscBlockingQueue<E>

  • All Implemented Interfaces:
    java.lang.Iterable<E>, java.util.Collection<E>, java.util.concurrent.BlockingQueue<E>, java.util.Queue<E>, org.jctools.queues.IndexedQueueSizeUtil.IndexedQueue, org.jctools.queues.MessagePassingQueue<E>, org.jctools.queues.QueueProgressIndicators, org.jctools.queues.SupportsIterator
    Enclosing class:
    JCToolsBlockingQueueFactory<E>

    private static final class JCToolsBlockingQueueFactory.MpscBlockingQueue<E>
    extends org.jctools.queues.MpscArrayQueue<E>
    implements java.util.concurrent.BlockingQueue<E>
    BlockingQueue wrapper for JCTools multiple producer single consumer array queue.
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.jctools.queues.MessagePassingQueue

        org.jctools.queues.MessagePassingQueue.Consumer<T extends java.lang.Object>, org.jctools.queues.MessagePassingQueue.ExitCondition, org.jctools.queues.MessagePassingQueue.Supplier<T extends java.lang.Object>, org.jctools.queues.MessagePassingQueue.WaitStrategy
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int capacity()  
      void clear()  
      long currentConsumerIndex()  
      long currentProducerIndex()  
      int drainTo​(java.util.Collection<? super E> c)  
      int drainTo​(java.util.Collection<? super E> c, int maxElements)  
      boolean isEmpty()  
      java.util.Iterator<E> iterator()  
      long lvConsumerIndex()  
      long lvProducerIndex()  
      boolean offer​(E e)  
      boolean offer​(E e, long timeout, java.util.concurrent.TimeUnit unit)  
      E poll​(long timeout, java.util.concurrent.TimeUnit unit)  
      void put​(E e)  
      int remainingCapacity()  
      int size()  
      E take()  
      java.lang.String toString()  
      • Methods inherited from class org.jctools.queues.MpscArrayQueue

        drain, drain, drain, failFastOffer, fill, fill, fill, offerIfBelowThreshold, peek, poll, relaxedOffer, relaxedPeek, relaxedPoll
      • Methods inherited from class java.util.AbstractQueue

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

        contains, containsAll, remove, removeAll, retainAll, toArray, toArray
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.concurrent.BlockingQueue

        add, contains, remove
      • Methods inherited from interface java.util.Collection

        addAll, clear, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface java.util.Queue

        element, peek, poll, remove
    • Method Detail

      • drainTo

        public int drainTo​(java.util.Collection<? super E> c)
        Specified by:
        drainTo in interface java.util.concurrent.BlockingQueue<E>
      • drainTo

        public int drainTo​(java.util.Collection<? super E> c,
                           int maxElements)
        Specified by:
        drainTo in interface java.util.concurrent.BlockingQueue<E>
      • offer

        public boolean offer​(E e,
                             long timeout,
                             java.util.concurrent.TimeUnit unit)
                      throws java.lang.InterruptedException
        Specified by:
        offer in interface java.util.concurrent.BlockingQueue<E>
        Throws:
        java.lang.InterruptedException
      • poll

        public E poll​(long timeout,
                      java.util.concurrent.TimeUnit unit)
               throws java.lang.InterruptedException
        Specified by:
        poll in interface java.util.concurrent.BlockingQueue<E>
        Throws:
        java.lang.InterruptedException
      • put

        public void put​(E e)
                 throws java.lang.InterruptedException
        Specified by:
        put in interface java.util.concurrent.BlockingQueue<E>
        Throws:
        java.lang.InterruptedException
      • offer

        public boolean offer​(E e)
        Specified by:
        offer in interface java.util.concurrent.BlockingQueue<E>
        Specified by:
        offer in interface org.jctools.queues.MessagePassingQueue<E>
        Specified by:
        offer in interface java.util.Queue<E>
        Overrides:
        offer in class org.jctools.queues.MpscArrayQueue<E>
      • remainingCapacity

        public int remainingCapacity()
        Specified by:
        remainingCapacity in interface java.util.concurrent.BlockingQueue<E>
      • take

        public E take()
               throws java.lang.InterruptedException
        Specified by:
        take in interface java.util.concurrent.BlockingQueue<E>
        Throws:
        java.lang.InterruptedException
      • lvConsumerIndex

        public final long lvConsumerIndex()
      • lvProducerIndex

        public final long lvProducerIndex()
      • size

        public int size()
        Specified by:
        size in interface java.util.Collection<E extends java.lang.Object>
        Specified by:
        size in interface org.jctools.queues.MessagePassingQueue<E extends java.lang.Object>
        Specified by:
        size in class java.util.AbstractCollection<E extends java.lang.Object>
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface java.util.Collection<E extends java.lang.Object>
        Specified by:
        isEmpty in interface org.jctools.queues.MessagePassingQueue<E extends java.lang.Object>
        Overrides:
        isEmpty in class java.util.AbstractCollection<E extends java.lang.Object>
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.util.AbstractCollection<E extends java.lang.Object>
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Collection<E extends java.lang.Object>
        Specified by:
        clear in interface org.jctools.queues.MessagePassingQueue<E extends java.lang.Object>
        Overrides:
        clear in class java.util.AbstractQueue<E extends java.lang.Object>
      • capacity

        public int capacity()
        Specified by:
        capacity in interface org.jctools.queues.IndexedQueueSizeUtil.IndexedQueue
        Specified by:
        capacity in interface org.jctools.queues.MessagePassingQueue<E extends java.lang.Object>
      • currentProducerIndex

        public long currentProducerIndex()
        Specified by:
        currentProducerIndex in interface org.jctools.queues.QueueProgressIndicators
      • currentConsumerIndex

        public long currentConsumerIndex()
        Specified by:
        currentConsumerIndex in interface org.jctools.queues.QueueProgressIndicators
      • iterator

        public java.util.Iterator<E> iterator()
        Specified by:
        iterator in interface java.util.Collection<E extends java.lang.Object>
        Specified by:
        iterator in interface java.lang.Iterable<E extends java.lang.Object>
        Specified by:
        iterator in class java.util.AbstractCollection<E extends java.lang.Object>