Class ForwardingBlockingQueue<E>
- java.lang.Object
 - 
- com.google.common.collect.ForwardingObject
 - 
- com.google.common.collect.ForwardingCollection<E>
 - 
- com.google.common.collect.ForwardingQueue<E>
 - 
- com.google.common.util.concurrent.ForwardingBlockingQueue<E>
 
 
 
 
 
- 
- Type Parameters:
 E- the type of elements held in this collection
- All Implemented Interfaces:
 Iterable<E>,Collection<E>,BlockingQueue<E>,Queue<E>
@GwtIncompatible public abstract class ForwardingBlockingQueue<E> extends ForwardingQueue<E> implements BlockingQueue<E>
ABlockingQueuewhich forwards all its method calls to anotherBlockingQueue. Subclasses should override one or more methods to modify the behavior of the backing collection as desired per the decorator pattern.defaultmethod warning: This class does not forward calls todefaultmethods. Instead, it inherits their default implementations. When those implementations invoke methods, they invoke methods on theForwardingBlockingQueue.- Since:
 - 4.0
 - Author:
 - Raimundo Mirisola
 
 
- 
- 
Constructor Summary
Constructors Modifier Constructor Description protectedForwardingBlockingQueue()Constructor for use by subclasses. 
- 
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract BlockingQueue<E>delegate()Returns the backing delegate instance that methods are forwarded to.intdrainTo(Collection<? super E> c)intdrainTo(Collection<? super E> c, int maxElements)booleanoffer(E e, long timeout, TimeUnit unit)@Nullable Epoll(long timeout, TimeUnit unit)voidput(E e)intremainingCapacity()Etake()- 
Methods inherited from class com.google.common.collect.ForwardingQueue
element, offer, peek, poll, remove, standardOffer, standardPeek, standardPoll 
- 
Methods inherited from class com.google.common.collect.ForwardingCollection
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, standardAddAll, standardClear, standardContains, standardContainsAll, standardIsEmpty, standardRemove, standardRemoveAll, standardRetainAll, standardToArray, standardToArray, standardToString, toArray, toArray 
- 
Methods inherited from class com.google.common.collect.ForwardingObject
toString 
- 
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, offer, 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 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
ForwardingBlockingQueue
protected ForwardingBlockingQueue()
Constructor for use by subclasses. 
 - 
 
- 
Method Detail
- 
delegate
protected abstract BlockingQueue<E> delegate()
Description copied from class:ForwardingObjectReturns 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 asForwardingSet.delegate(). Concrete subclasses override this method to supply the instance being decorated.- Specified by:
 delegatein classForwardingQueue<E>
 
- 
drainTo
@CanIgnoreReturnValue public int drainTo(Collection<? super E> c, int maxElements)
- Specified by:
 drainToin interfaceBlockingQueue<E>
 
- 
drainTo
@CanIgnoreReturnValue public int drainTo(Collection<? super E> c)
- Specified by:
 drainToin interfaceBlockingQueue<E>
 
- 
offer
@CanIgnoreReturnValue public boolean offer(E e, long timeout, TimeUnit unit) throws InterruptedException
- Specified by:
 offerin interfaceBlockingQueue<E>- Throws:
 InterruptedException
 
- 
poll
@CanIgnoreReturnValue public @Nullable E poll(long timeout, TimeUnit unit) throws InterruptedException
- Specified by:
 pollin interfaceBlockingQueue<E>- Throws:
 InterruptedException
 
- 
put
public void put(E e) throws InterruptedException
- Specified by:
 putin interfaceBlockingQueue<E>- Throws:
 InterruptedException
 
- 
remainingCapacity
public int remainingCapacity()
- Specified by:
 remainingCapacityin interfaceBlockingQueue<E>
 
- 
take
@CanIgnoreReturnValue public E take() throws InterruptedException
- Specified by:
 takein interfaceBlockingQueue<E>- Throws:
 InterruptedException
 
 - 
 
 -