BlockingDeque which forwards all its method calls to another BlockingDeque.
Subclasses should override one or more methods to modify the behavior of the backing deque as
desired per the decorator pattern.Warning
The methods of ForwardingBlockingDeque forward indiscriminately
to the methods of the delegate. For example, overriding add alone will not change
the behaviour of offer which can lead to unexpected behaviour. In this case, you should
override offer as well, either providing your own implementation, or delegating to the
provided standardOffer method.
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 ForwardingBlockingDeque.
The standard methods are not guaranteed to be thread-safe, even when all of the
methods that they depend on are thread-safe.
com.google.common.collect.ForwardingBlockingDeque )
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| protected abstract BlockingDeque | delegate()
Implements abstract com. |
| public int | drainTo(Collection<? super E>
the collection to transfer elements into c)Implements java. |
| 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 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 boolean | offerFirst(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 boolean | offerLast(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 E | pollFirst(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 | pollLast(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 void | putFirst(E
the element to add e)Implements java. |
| public void | putLast(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. |
| public E | takeFirst()
Implements java. |
| public E | takeLast()
Implements java. |
| ForwardingBlockingDeque | back to summary |
|---|---|
| protected ForwardingBlockingDeque() Constructor for use by subclasses. | |
| delegate | back to summary |
|---|---|
| protected abstract BlockingDeque 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) 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
| |
| 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
| |
| 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 the queue represented by this deque (in other words, at the tail of this deque), waiting up to the specified wait time if necessary for space to become available. This method is equivalent to
| |
| offerFirst | back to summary |
|---|---|
| public boolean offerFirst(E e, long timeout, TimeUnit unit) throws InterruptedException Implements java. Doc from java. Inserts the specified element at the front of this deque, waiting up to the specified wait time if necessary for space to become available.
| |
| offerLast | back to summary |
|---|---|
| public boolean offerLast(E e, long timeout, TimeUnit unit) throws InterruptedException Implements java. Doc from java. Inserts the specified element at the end of this deque, 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 the queue represented by this deque (in other words, the first element of this deque), waiting up to the specified wait time if necessary for an element to become available. This method is equivalent to
| |
| pollFirst | back to summary |
|---|---|
| public E pollFirst(long timeout, TimeUnit unit) throws InterruptedException Implements java. Doc from java. Retrieves and removes the first element of this deque, waiting up to the specified wait time if necessary for an element to become available.
| |
| pollLast | back to summary |
|---|---|
| public E pollLast(long timeout, TimeUnit unit) throws InterruptedException Implements java. Doc from java. Retrieves and removes the last element of this deque, 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 the queue represented by this deque (in other words, at the tail of this deque), waiting if necessary for space to become available. This method is equivalent to
| |
| putFirst | back to summary |
|---|---|
| public void putFirst(E e) throws InterruptedException Implements java. Doc from java. Inserts the specified element at the front of this deque, waiting if necessary for space to become available.
| |
| putLast | back to summary |
|---|---|
| public void putLast(E e) throws InterruptedException Implements java. Doc from java. Inserts the specified element at the end of this deque, 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 the queue represented by this deque (in other words, the first element of this deque), waiting if necessary until an element becomes available. This method is equivalent to
| |
| takeFirst | back to summary |
|---|---|
| public E takeFirst() throws InterruptedException Implements java. Doc from java. Retrieves and removes the first element of this deque, waiting if necessary until an element becomes available.
| |
| takeLast | back to summary |
|---|---|
| public E takeLast() throws InterruptedException Implements java. Doc from java. Retrieves and removes the last element of this deque, waiting if necessary until an element becomes available.
| |