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.
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| protected abstract BlockingQueue | delegate()
Implements abstract com. |
| public int | drainTo(Collection<? super E>
the collection to transfer elements into c, int the maximum number of elements to transfer maxElements)Implements java. |
| public int | drainTo(Collection<? super E>
the collection to transfer elements into c)Implements java. |
| public boolean | offer(E
the element to add e, long how long to wait before giving up, in units of
timeout, TimeUnit unita unit)TimeUnit determining how to interpret the
timeout parameterImplements java. |
| public E | poll(long
how long to wait before giving up, in units of
timeout, TimeUnit unita unit)TimeUnit determining how to interpret the
timeout parameterImplements java. |
| public void | put(E
the element to add e)Implements java. |
| public int | remainingCapacity()
Implements java. Integer.MAX_VALUE if there is no intrinsic
limit.
|
| public E | take()
Implements java. |
| ForwardingBlockingQueue | back to summary |
|---|---|
| protected ForwardingBlockingQueue() Constructor for use by subclasses. | |
| delegate | back to summary |
|---|---|
| protected abstract BlockingQueue Implements abstract com. Doc from com. 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
| |
| drainTo | back to summary |
|---|---|
| public int drainTo(Collection<? super E> c, int maxElements) Implements java. Doc from java. Removes at most the given number of available elements from
this queue and adds them to the given collection. A failure
encountered while attempting to add elements to
collection
| |
| drainTo | back to summary |
|---|---|
| public int drainTo(Collection<? super E> c) Implements java. Doc from java. Removes all available elements from this queue and adds them
to the given collection. This operation may be more
efficient than repeatedly polling this queue. A failure
encountered while attempting to add elements to
collection
| |
| offer | back to summary |
|---|---|
| public boolean offer(E e, long timeout, TimeUnit unit) throws InterruptedException Implements java. Doc from java. Inserts the specified element into this queue, waiting up to the specified wait time if necessary for space to become available.
| |
| poll | back to summary |
|---|---|
| public E poll(long timeout, TimeUnit unit) throws InterruptedException Implements java. Doc from java. Retrieves and removes the head of this queue, waiting up to the specified wait time if necessary for an element to become available.
| |
| put | back to summary |
|---|---|
| public void put(E e) throws InterruptedException Implements java. Doc from java. Inserts the specified element into this queue, waiting if necessary for space to become available.
| |
| remainingCapacity | back to summary |
|---|---|
| public int remainingCapacity() Implements java. Doc from java. Returns the number of additional elements that this queue can ideally
(in the absence of memory or resource constraints) accept without
blocking, or Note that you cannot always tell if an attempt to insert
an element will succeed by inspecting
| |
| take | back to summary |
|---|---|
| public E take() throws InterruptedException Implements java. Doc from java. Retrieves and removes the head of this queue, waiting if necessary until an element becomes available.
| |