Package io.netty.util

Class Recycler.BlockingMessageQueue<T>

  • All Implemented Interfaces:
    org.jctools.queues.MessagePassingQueue<T>
    Enclosing class:
    Recycler<T>

    private static final class Recycler.BlockingMessageQueue<T>
    extends java.lang.Object
    implements org.jctools.queues.MessagePassingQueue<T>
    This is an implementation of MessagePassingQueue, similar to what might be returned from PlatformDependent.newMpscQueue(int), but intended to be used for debugging purpose. The implementation relies on synchronised monitor locks for thread-safety. The fill bulk operation is not supported by this implementation.
    • 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
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Queue<T> deque  
      private int maxCapacity  
      • Fields inherited from interface org.jctools.queues.MessagePassingQueue

        UNBOUNDED_CAPACITY
    • Constructor Summary

      Constructors 
      Constructor Description
      BlockingMessageQueue​(int maxCapacity)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int capacity()  
      void clear()  
      int drain​(org.jctools.queues.MessagePassingQueue.Consumer<T> c)  
      int drain​(org.jctools.queues.MessagePassingQueue.Consumer<T> c, int limit)  
      void drain​(org.jctools.queues.MessagePassingQueue.Consumer<T> c, org.jctools.queues.MessagePassingQueue.WaitStrategy wait, org.jctools.queues.MessagePassingQueue.ExitCondition exit)  
      int fill​(org.jctools.queues.MessagePassingQueue.Supplier<T> s)  
      int fill​(org.jctools.queues.MessagePassingQueue.Supplier<T> s, int limit)  
      void fill​(org.jctools.queues.MessagePassingQueue.Supplier<T> s, org.jctools.queues.MessagePassingQueue.WaitStrategy wait, org.jctools.queues.MessagePassingQueue.ExitCondition exit)  
      boolean isEmpty()  
      boolean offer​(T e)  
      T peek()  
      T poll()  
      boolean relaxedOffer​(T e)  
      T relaxedPeek()  
      T relaxedPoll()  
      int size()  
      • Methods inherited from class java.lang.Object

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

      • deque

        private final java.util.Queue<T> deque
      • maxCapacity

        private final int maxCapacity
    • Constructor Detail

      • BlockingMessageQueue

        BlockingMessageQueue​(int maxCapacity)
    • Method Detail

      • offer

        public boolean offer​(T e)
        Specified by:
        offer in interface org.jctools.queues.MessagePassingQueue<T>
      • poll

        public T poll()
        Specified by:
        poll in interface org.jctools.queues.MessagePassingQueue<T>
      • peek

        public T peek()
        Specified by:
        peek in interface org.jctools.queues.MessagePassingQueue<T>
      • size

        public int size()
        Specified by:
        size in interface org.jctools.queues.MessagePassingQueue<T>
      • clear

        public void clear()
        Specified by:
        clear in interface org.jctools.queues.MessagePassingQueue<T>
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface org.jctools.queues.MessagePassingQueue<T>
      • capacity

        public int capacity()
        Specified by:
        capacity in interface org.jctools.queues.MessagePassingQueue<T>
      • relaxedOffer

        public boolean relaxedOffer​(T e)
        Specified by:
        relaxedOffer in interface org.jctools.queues.MessagePassingQueue<T>
      • relaxedPoll

        public T relaxedPoll()
        Specified by:
        relaxedPoll in interface org.jctools.queues.MessagePassingQueue<T>
      • relaxedPeek

        public T relaxedPeek()
        Specified by:
        relaxedPeek in interface org.jctools.queues.MessagePassingQueue<T>
      • drain

        public int drain​(org.jctools.queues.MessagePassingQueue.Consumer<T> c,
                         int limit)
        Specified by:
        drain in interface org.jctools.queues.MessagePassingQueue<T>
      • fill

        public int fill​(org.jctools.queues.MessagePassingQueue.Supplier<T> s,
                        int limit)
        Specified by:
        fill in interface org.jctools.queues.MessagePassingQueue<T>
      • drain

        public int drain​(org.jctools.queues.MessagePassingQueue.Consumer<T> c)
        Specified by:
        drain in interface org.jctools.queues.MessagePassingQueue<T>
      • fill

        public int fill​(org.jctools.queues.MessagePassingQueue.Supplier<T> s)
        Specified by:
        fill in interface org.jctools.queues.MessagePassingQueue<T>
      • drain

        public void drain​(org.jctools.queues.MessagePassingQueue.Consumer<T> c,
                          org.jctools.queues.MessagePassingQueue.WaitStrategy wait,
                          org.jctools.queues.MessagePassingQueue.ExitCondition exit)
        Specified by:
        drain in interface org.jctools.queues.MessagePassingQueue<T>
      • fill

        public void fill​(org.jctools.queues.MessagePassingQueue.Supplier<T> s,
                         org.jctools.queues.MessagePassingQueue.WaitStrategy wait,
                         org.jctools.queues.MessagePassingQueue.ExitCondition exit)
        Specified by:
        fill in interface org.jctools.queues.MessagePassingQueue<T>