Class ForwardingBlockingDeque<E>
- java.lang.Object
- 
- com.google.common.collect.ForwardingObject
- 
- com.google.common.collect.ForwardingCollection<E>
- 
- com.google.common.collect.ForwardingQueue<E>
- 
- com.google.common.collect.ForwardingDeque<E>
- 
- com.google.common.util.concurrent.ForwardingBlockingDeque<E>
 
 
 
 
 
- 
- All Implemented Interfaces:
- java.lang.Iterable<E>,- java.util.Collection<E>,- java.util.concurrent.BlockingDeque<E>,- java.util.concurrent.BlockingQueue<E>,- java.util.Deque<E>,- java.util.Queue<E>
 
 @GwtIncompatible public abstract class ForwardingBlockingDeque<E> extends ForwardingDeque<E> implements java.util.concurrent.BlockingDeque<E> ABlockingDequewhich forwards all its method calls to anotherBlockingDeque. 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 ForwardingBlockingDequeforward indiscriminately to the methods of the delegate. For example, overridingForwardingCollection.add(E)alone will not change the behaviour ofoffer(E, long, java.util.concurrent.TimeUnit)which can lead to unexpected behaviour. In this case, you should overrideofferas well, either providing your own implementation, or delegating to the providedstandardOffermethod.defaultmethod warning: This class does not forward calls todefaultmethods. Instead, it inherits their default implementations. When those implementations invoke methods, they invoke methods on theForwardingBlockingDeque.The standardmethods are not guaranteed to be thread-safe, even when all of the methods that they depend on are thread-safe.- Since:
- 21.0 (since 14.0 as ForwardingBlockingDeque)
- Author:
- Emily Soldal
 
- 
- 
Constructor SummaryConstructors Modifier Constructor Description protectedForwardingBlockingDeque()Constructor for use by subclasses.
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract java.util.concurrent.BlockingDeque<E>delegate()Returns the backing delegate instance that methods are forwarded to.intdrainTo(java.util.Collection<? super E> c)intdrainTo(java.util.Collection<? super E> c, int maxElements)booleanoffer(E e, long timeout, java.util.concurrent.TimeUnit unit)booleanofferFirst(E e, long timeout, java.util.concurrent.TimeUnit unit)booleanofferLast(E e, long timeout, java.util.concurrent.TimeUnit unit)Epoll(long timeout, java.util.concurrent.TimeUnit unit)EpollFirst(long timeout, java.util.concurrent.TimeUnit unit)EpollLast(long timeout, java.util.concurrent.TimeUnit unit)voidput(E e)voidputFirst(E e)voidputLast(E e)intremainingCapacity()Etake()EtakeFirst()EtakeLast()- 
Methods inherited from class com.google.common.collect.ForwardingDequeaddFirst, addLast, descendingIterator, getFirst, getLast, offerFirst, offerLast, peekFirst, peekLast, pollFirst, pollLast, pop, push, removeFirst, removeFirstOccurrence, removeLast, removeLastOccurrence
 - 
Methods inherited from class com.google.common.collect.ForwardingQueueelement, offer, peek, poll, remove, standardOffer, standardPeek, standardPoll
 - 
Methods inherited from class com.google.common.collect.ForwardingCollectionadd, 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.ForwardingObjecttoString
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface java.util.concurrent.BlockingDequeadd, addFirst, addLast, contains, element, iterator, offer, offerFirst, offerLast, peek, poll, push, remove, remove, removeFirstOccurrence, removeLastOccurrence, size
 - 
Methods inherited from interface java.util.Collectionclear, containsAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray, toArray
 
- 
 
- 
- 
- 
Constructor Detail- 
ForwardingBlockingDequeprotected ForwardingBlockingDeque() Constructor for use by subclasses.
 
- 
 - 
Method Detail- 
delegateprotected abstract java.util.concurrent.BlockingDeque<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 class- ForwardingDeque<E>
 
 - 
remainingCapacitypublic int remainingCapacity() - Specified by:
- remainingCapacityin interface- java.util.concurrent.BlockingQueue<E>
 
 - 
putFirstpublic void putFirst(E e) throws java.lang.InterruptedException - Specified by:
- putFirstin interface- java.util.concurrent.BlockingDeque<E>
- Throws:
- java.lang.InterruptedException
 
 - 
putLastpublic void putLast(E e) throws java.lang.InterruptedException - Specified by:
- putLastin interface- java.util.concurrent.BlockingDeque<E>
- Throws:
- java.lang.InterruptedException
 
 - 
offerFirstpublic boolean offerFirst(E e, long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException - Specified by:
- offerFirstin interface- java.util.concurrent.BlockingDeque<E>
- Throws:
- java.lang.InterruptedException
 
 - 
offerLastpublic boolean offerLast(E e, long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException - Specified by:
- offerLastin interface- java.util.concurrent.BlockingDeque<E>
- Throws:
- java.lang.InterruptedException
 
 - 
takeFirstpublic E takeFirst() throws java.lang.InterruptedException - Specified by:
- takeFirstin interface- java.util.concurrent.BlockingDeque<E>
- Throws:
- java.lang.InterruptedException
 
 - 
takeLastpublic E takeLast() throws java.lang.InterruptedException - Specified by:
- takeLastin interface- java.util.concurrent.BlockingDeque<E>
- Throws:
- java.lang.InterruptedException
 
 - 
pollFirst@CheckForNull public E pollFirst(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException - Specified by:
- pollFirstin interface- java.util.concurrent.BlockingDeque<E>
- Throws:
- java.lang.InterruptedException
 
 - 
pollLast@CheckForNull public E pollLast(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException - Specified by:
- pollLastin interface- java.util.concurrent.BlockingDeque<E>
- Throws:
- java.lang.InterruptedException
 
 - 
offerpublic boolean offer(E e, long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException 
 - 
poll@CheckForNull public E poll(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException 
 - 
drainTopublic int drainTo(java.util.Collection<? super E> c) - Specified by:
- drainToin interface- java.util.concurrent.BlockingQueue<E>
 
 
- 
 
-