Interface CheckedFuture<V,X extends java.lang.Exception>
-
- All Superinterfaces:
java.util.concurrent.Future<V>
,ListenableFuture<V>
- All Known Implementing Classes:
AbstractCheckedFuture
,ForwardingCheckedFuture
,ForwardingCheckedFuture.SimpleForwardingCheckedFuture
@Beta @Deprecated(since="2022-12-01") public interface CheckedFuture<V,X extends java.lang.Exception> extends ListenableFuture<V>
Deprecated.The Google Guava Core Libraries are deprecated and will not be part of the AEM SDK after April 2023ACheckedFuture
is aListenableFuture
that includes versions of theget
methods that can throw a checked exception. This makes it easier to create a future that executes logic which can throw an exception.A common implementation is
Futures.immediateCheckedFuture(V)
.Implementations of this interface must adapt the exceptions thrown by
Future#get()
:CancellationException
,ExecutionException
andInterruptedException
into the type specified by theX
type parameter.This interface also extends the ListenableFuture interface to allow listeners to be added. This allows the future to be used as a normal
Future
or as an asynchronous callback mechanism as needed. This allows multiple callbacks to be registered for a particular task, and the future will guarantee execution of all listeners when the task completes.For a simpler alternative to CheckedFuture, consider accessing Future values with
Futures.get()
.- Since:
- 1.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description V
checkedGet()
Deprecated.Exception checking version ofFuture.get()
that will translateInterruptedException
,CancellationException
andExecutionException
into application-specific exceptions.V
checkedGet(long timeout, java.util.concurrent.TimeUnit unit)
Deprecated.Exception checking version ofFuture.get(long, TimeUnit)
that will translateInterruptedException
,CancellationException
andExecutionException
into application-specific exceptions.-
Methods inherited from interface com.google.common.util.concurrent.ListenableFuture
addListener
-
-
-
-
Method Detail
-
checkedGet
V checkedGet() throws X extends java.lang.Exception
Deprecated.Exception checking version ofFuture.get()
that will translateInterruptedException
,CancellationException
andExecutionException
into application-specific exceptions.
-
checkedGet
V checkedGet(long timeout, java.util.concurrent.TimeUnit unit) throws java.util.concurrent.TimeoutException, X extends java.lang.Exception
Deprecated.Exception checking version ofFuture.get(long, TimeUnit)
that will translateInterruptedException
,CancellationException
andExecutionException
into application-specific exceptions. On timeout this method throws a normalTimeoutException
.
-
-