Class InternalFutureFailureAccess
- java.lang.Object
-
- com.google.common.util.concurrent.internal.InternalFutureFailureAccess
-
public abstract class InternalFutureFailureAccess extends Object
A future that, if it fails, may optionally provide access to the cause of the failure.This class is used only for micro-optimization. Standard
Future
utilities benefit from this optimization, so there is no need to specialize methods to return or accept this type instead ofListenableFuture
.This class is GWT-compatible.
- Since:
com.google.guava:failureaccess:1.0
, which was added as a dependency of Guava in Guava 27.0
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
InternalFutureFailureAccess()
Constructor for use by subclasses.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description protected abstract Throwable
tryInternalFastPathGetFailure()
Usually returnsnull
but, if thisFuture
has failed, may optionally return the cause of the failure.
-
-
-
Constructor Detail
-
InternalFutureFailureAccess
protected InternalFutureFailureAccess()
Constructor for use by subclasses.
-
-
Method Detail
-
tryInternalFastPathGetFailure
protected abstract Throwable tryInternalFastPathGetFailure()
Usually returnsnull
but, if thisFuture
has failed, may optionally return the cause of the failure. "Failure" means specifically "completed with an exception"; it does not include "was cancelled." To be explicit: If this method returns a non-null value, then:isDone()
must returntrue
isCancelled()
must returnfalse
get()
must not block, and it must throw anExecutionException
with the return value of this method as its cause
This method is
protected
so that classes likecom.google.common.util.concurrent.SettableFuture
do not expose it to their users as an instance method. In the unlikely event that you need to call this method, callInternalFutures.tryInternalFastPathGetFailure(InternalFutureFailureAccess)
.
-
-