com.google.common.util.concurrent
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>
public abstract class ForwardingBlockingQueue<E>
- extends ForwardingQueue<E>
- implements 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.
- Since:
- 4.0
- Author:
- Raimundo Mirisola
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 interface java.util.Collection |
addAll, clear, containsAll, equals, hashCode, isEmpty, iterator, removeAll, retainAll, size, toArray, toArray |
ForwardingBlockingQueue
protected ForwardingBlockingQueue()
- Constructor for use by subclasses.
delegate
protected abstract BlockingQueue<E> delegate()
- 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
public int drainTo(Collection<? super E> c,
int maxElements)
- Specified by:
drainTo
in interface BlockingQueue<E>
drainTo
public int drainTo(Collection<? super E> c)
- Specified by:
drainTo
in interface BlockingQueue<E>
offer
public boolean offer(E e,
long timeout,
TimeUnit unit)
throws InterruptedException
- Specified by:
offer
in interface BlockingQueue<E>
- Throws:
InterruptedException
poll
public E poll(long timeout,
TimeUnit unit)
throws InterruptedException
- Specified by:
poll
in interface BlockingQueue<E>
- Throws:
InterruptedException
put
public void put(E e)
throws InterruptedException
- Specified by:
put
in interface BlockingQueue<E>
- Throws:
InterruptedException
remainingCapacity
public int remainingCapacity()
- Specified by:
remainingCapacity
in interface BlockingQueue<E>
take
public E take()
throws InterruptedException
- Specified by:
take
in interface BlockingQueue<E>
- Throws:
InterruptedException
Copyright © 2010-2012. All Rights Reserved.