Class ForwardingBlockingDeque<E>

  • All Implemented Interfaces:
    <E>, <E>, <E>, <E>, <E>, <E>

    @GwtIncompatible
    public abstract class ForwardingBlockingDeque<E>
    extends ForwardingDeque<E>
    implements <E>
    Deprecated.
    This class has moved to com.google.common.util.concurrent. Please use ForwardingBlockingDeque instead.
    A 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 .

    Warning: The methods of ForwardingBlockingDeque forward indiscriminately to the methods of the delegate. For example, overriding ForwardingCollection.add(E) alone will not change the behaviour of offer(E, long, java.util.concurrent.TimeUnit) 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.

    Since:
    14.0
    Author:
    Emily Soldal
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected ForwardingBlockingDeque()
      Deprecated.
      Constructor for use by subclasses.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      protected abstract <E> delegate()
      Deprecated.
      Returns the backing delegate instance that methods are forwarded to.
      int <? super E> c)
      Deprecated.
      Removes all available elements from this queue and adds them to the given collection.
      int <? super E> c, int maxElements)
      Deprecated.
      Removes at most the given number of available elements from this queue and adds them to the given collection.
      boolean offer​(E e, long timeout,  unit)
      Deprecated.
      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.
      boolean offerFirst​(E e, long timeout,  unit)
      Deprecated.
      Inserts the specified element at the front of this deque, waiting up to the specified wait time if necessary for space to become available.
      boolean offerLast​(E e, long timeout,  unit)
      Deprecated.
      Inserts the specified element at the end of this deque, waiting up to the specified wait time if necessary for space to become available.
      E poll​(long timeout,  unit)
      Deprecated.
      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.
      E pollFirst​(long timeout,  unit)
      Deprecated.
      Retrieves and removes the first element of this deque, waiting up to the specified wait time if necessary for an element to become available.
      E pollLast​(long timeout,  unit)
      Deprecated.
      Retrieves and removes the last element of this deque, waiting up to the specified wait time if necessary for an element to become available.
      void put​(E e)
      Deprecated.
      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.
      void putFirst​(E e)
      Deprecated.
      Inserts the specified element at the front of this deque, waiting if necessary for space to become available.
      void putLast​(E e)
      Deprecated.
      Inserts the specified element at the end of this deque, waiting if necessary for space to become available.
      int remainingCapacity()
      Deprecated.
      Returns the number of additional elements that this queue can ideally (in the absence of memory or resource constraints) accept without blocking, or Integer.MAX_VALUE if there is no intrinsic limit.
      E take()
      Deprecated.
      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.
      E takeFirst()
      Deprecated.
      Retrieves and removes the first element of this deque, waiting if necessary until an element becomes available.
      E takeLast()
      Deprecated.
      Retrieves and removes the last element of this deque, waiting if necessary until an element becomes available.
      • Methods inherited from class java.lang.

        , , , , , , , , ,
      • Methods inherited from interface java.util.concurrent.

        , , , , , , , , , , , , , , , ,
      • Methods inherited from interface java.util.

        , , , , , , , , , , , , ,
      • Methods inherited from interface java.util.

        , , , , , , , , , , , , , ,
      • Methods inherited from interface java.lang.

    • Constructor Detail

    • Method Detail

      • delegate

        protected abstract <Edelegate()
        Deprecated.
        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 ForwardingDeque<E>
      • remainingCapacity

        public int remainingCapacity()
        Deprecated.
        Description copied from interface: 
        Returns the number of additional elements that this queue can ideally (in the absence of memory or resource constraints) accept without blocking, or Integer.MAX_VALUE if there is no intrinsic limit.

        Note that you cannot always tell if an attempt to insert an element will succeed by inspecting remainingCapacity because it may be the case that another thread is about to insert or remove an element.

        Specified by:
         in interface <E>
        Returns:
        the remaining capacity
      • putFirst

        public void putFirst​(E e)
                      throws 
        Deprecated.
        Description copied from interface: 
        Inserts the specified element at the front of this deque, waiting if necessary for space to become available.
        Specified by:
         in interface <E>
        Parameters:
        e - the element to add
        Throws:
        - if interrupted while waiting
      • putLast

        public void putLast​(E e)
                     throws 
        Deprecated.
        Description copied from interface: 
        Inserts the specified element at the end of this deque, waiting if necessary for space to become available.
        Specified by:
         in interface <E>
        Parameters:
        e - the element to add
        Throws:
        - if interrupted while waiting
      • offerFirst

        public boolean offerFirst​(E e,
                                  long timeout,
                                   unit)
                           throws 
        Deprecated.
        Description copied from interface: 
        Inserts the specified element at the front of this deque, waiting up to the specified wait time if necessary for space to become available.
        Specified by:
         in interface <E>
        Parameters:
        e - the element to add
        timeout - how long to wait before giving up, in units of unit
        unit - a TimeUnit determining how to interpret the timeout parameter
        Returns:
        true if successful, or false if the specified waiting time elapses before space is available
        Throws:
        - if interrupted while waiting
      • offerLast

        public boolean offerLast​(E e,
                                 long timeout,
                                  unit)
                          throws 
        Deprecated.
        Description copied from interface: 
        Inserts the specified element at the end of this deque, waiting up to the specified wait time if necessary for space to become available.
        Specified by:
         in interface <E>
        Parameters:
        e - the element to add
        timeout - how long to wait before giving up, in units of unit
        unit - a TimeUnit determining how to interpret the timeout parameter
        Returns:
        true if successful, or false if the specified waiting time elapses before space is available
        Throws:
        - if interrupted while waiting
      • takeFirst

        public E takeFirst()
                    throws 
        Deprecated.
        Description copied from interface: 
        Retrieves and removes the first element of this deque, waiting if necessary until an element becomes available.
        Specified by:
         in interface <E>
        Returns:
        the head of this deque
        Throws:
        - if interrupted while waiting
      • takeLast

        public E takeLast()
                   throws 
        Deprecated.
        Description copied from interface: 
        Retrieves and removes the last element of this deque, waiting if necessary until an element becomes available.
        Specified by:
         in interface <E>
        Returns:
        the tail of this deque
        Throws:
        - if interrupted while waiting
      • pollFirst

        public E pollFirst​(long timeout,
                            unit)
                    throws 
        Deprecated.
        Description copied from interface: 
        Retrieves and removes the first element of this deque, waiting up to the specified wait time if necessary for an element to become available.
        Specified by:
         in interface <E>
        Parameters:
        timeout - how long to wait before giving up, in units of unit
        unit - a TimeUnit determining how to interpret the timeout parameter
        Returns:
        the head of this deque, or null if the specified waiting time elapses before an element is available
        Throws:
        - if interrupted while waiting
      • pollLast

        public E pollLast​(long timeout,
                           unit)
                   throws 
        Deprecated.
        Description copied from interface: 
        Retrieves and removes the last element of this deque, waiting up to the specified wait time if necessary for an element to become available.
        Specified by:
         in interface <E>
        Parameters:
        timeout - how long to wait before giving up, in units of unit
        unit - a TimeUnit determining how to interpret the timeout parameter
        Returns:
        the tail of this deque, or null if the specified waiting time elapses before an element is available
        Throws:
        - if interrupted while waiting
      • put

        public void put​(E e)
                 throws 
        Deprecated.
        Description copied from interface: 
        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 .

        Specified by:
         in interface <E>
        Specified by:
         in interface <E>
        Parameters:
        e - the element to add
        Throws:
        - if interrupted while waiting
      • offer

        public boolean offer​(E e,
                             long timeout,
                              unit)
                      throws 
        Deprecated.
        Description copied from interface: 
        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 .

        Specified by:
         in interface <E>
        Specified by:
         in interface <E>
        Parameters:
        e - the element to add
        timeout - how long to wait before giving up, in units of unit
        unit - a TimeUnit determining how to interpret the timeout parameter
        Returns:
        true if the element was added to this deque, else false
        Throws:
        - if interrupted while waiting
      • take

        public E take()
               throws 
        Deprecated.
        Description copied from interface: 
        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 .

        Specified by:
         in interface <E>
        Specified by:
         in interface <E>
        Returns:
        the head of this deque
        Throws:
        - if interrupted while waiting
      • poll

        public E poll​(long timeout,
                       unit)
               throws 
        Deprecated.
        Description copied from interface: 
        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 .

        Specified by:
         in interface <E>
        Specified by:
         in interface <E>
        Parameters:
        timeout - how long to wait before giving up, in units of unit
        unit - a TimeUnit determining how to interpret the timeout parameter
        Returns:
        the head of this deque, or null if the specified waiting time elapses before an element is available
        Throws:
        - if interrupted while waiting
      • drainTo

        public int <? super E> c)
        Deprecated.
        Description copied from interface: 
        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 c may result in elements being in neither, either or both collections when the associated exception is thrown. Attempts to drain a queue to itself result in IllegalArgumentException. Further, the behavior of this operation is undefined if the specified collection is modified while the operation is in progress.
        Specified by:
         in interface <E>
        Parameters:
        c - the collection to transfer elements into
        Returns:
        the number of elements transferred
      • drainTo

        public int <? super E> c,
                           int maxElements)
        Deprecated.
        Description copied from interface: 
        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 c may result in elements being in neither, either or both collections when the associated exception is thrown. Attempts to drain a queue to itself result in IllegalArgumentException. Further, the behavior of this operation is undefined if the specified collection is modified while the operation is in progress.
        Specified by:
         in interface <E>
        Parameters:
        c - the collection to transfer elements into
        maxElements - the maximum number of elements to transfer
        Returns:
        the number of elements transferred