Class ForwardingCheckedFuture<V,​X extends java.lang.Exception>

  • Type Parameters:
    V - The result type returned by this Future's get method
    X - The type of the Exception thrown by the Future's checkedGet method
    All Implemented Interfaces:
    CheckedFuture<V,​X>, ListenableFuture<V>, java.util.concurrent.Future<V>
    Direct Known Subclasses:
    ForwardingCheckedFuture.SimpleForwardingCheckedFuture

    @Beta
    @Deprecated
    @GwtIncompatible
    public abstract class ForwardingCheckedFuture<V,​X extends java.lang.Exception>
    extends ForwardingListenableFuture<V>
    implements CheckedFuture<V,​X>
    Deprecated.
    CheckedFuture cannot properly support the chained operations that are the primary goal of ListenableFuture. CheckedFuture also encourages users to rethrow exceptions from one thread in another thread, producing misleading stack traces. Additionally, it has a surprising policy about which exceptions to map and which to leave untouched. Guava users who want a CheckedFuture can fork the classes for their own use, possibly specializing them to the particular exception type they use. We recommend that most people use ListenableFuture and perform any exception wrapping themselves. This class is scheduled for removal from Guava in February 2018.
    A future which forwards all its method calls to another future. Subclasses should override one or more methods to modify the behavior of the backing future as desired per the decorator pattern.

    Most subclasses can simply extend ForwardingCheckedFuture.SimpleForwardingCheckedFuture.

    Since:
    9.0
    Author:
    Anthony Zana
    • Method Detail

      • checkedGet

        public V checkedGet()
                     throws X extends java.lang.Exception
        Deprecated.
        Description copied from interface: CheckedFuture
        Exception checking version of Future.get() that will translate InterruptedException, CancellationException and ExecutionException into application-specific exceptions.
        Specified by:
        checkedGet in interface CheckedFuture<V,​X extends java.lang.Exception>
        Returns:
        the result of executing the future.
        Throws:
        X - on interruption, cancellation or execution exceptions.
        X extends java.lang.Exception
      • checkedGet

        public V checkedGet​(long timeout,
                            java.util.concurrent.TimeUnit unit)
                     throws java.util.concurrent.TimeoutException,
                            X extends java.lang.Exception
        Deprecated.
        Description copied from interface: CheckedFuture
        Exception checking version of Future.get(long, TimeUnit) that will translate InterruptedException, CancellationException and ExecutionException into application-specific exceptions. On timeout this method throws a normal TimeoutException.
        Specified by:
        checkedGet in interface CheckedFuture<V,​X extends java.lang.Exception>
        Returns:
        the result of executing the future.
        Throws:
        java.util.concurrent.TimeoutException - if retrieving the result timed out.
        X - on interruption, cancellation or execution exceptions.
        X extends java.lang.Exception