Class ForwardingBlockingQueue<E>

  • Type Parameters:
    E - the type of elements held in this collection
    All Implemented Interfaces:
    java.lang.Iterable<E>, java.util.Collection<E>, java.util.concurrent.BlockingQueue<E>, java.util.Queue<E>

    @GwtIncompatible
    public abstract class ForwardingBlockingQueue<E>
    extends ForwardingQueue<E>
    implements java.util.concurrent.BlockingQueue<E>
    A BlockingQueue which forwards all its method calls to another BlockingQueue. Subclasses should override one or more methods to modify the behavior of the backing collection as desired per the decorator pattern.

    default method warning: This class does not forward calls to default methods. Instead, it inherits their default implementations. When those implementations invoke methods, they invoke methods on the ForwardingBlockingQueue.

    Since:
    4.0
    Author:
    Raimundo Mirisola
    • Method Detail

      • delegate

        protected abstract java.util.concurrent.BlockingQueue<Edelegate()
        Description copied from class: ForwardingObject
        Returns the backing delegate instance that methods are forwarded to. Abstract subclasses generally override this method with an abstract method that has a more specific return type, such as ForwardingSet.delegate(). Concrete subclasses override this method to supply the instance being decorated.
        Specified by:
        delegate in class ForwardingQueue<E>
      • drainTo

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

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

        @CanIgnoreReturnValue
        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

        @CanIgnoreReturnValue
        @CheckForNull
        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
      • remainingCapacity

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

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