Uses of Interface
com.google.common.util.concurrent.ListenableFuture
Packages that use ListenableFuture
-
Uses of ListenableFuture in com.google.common.cache
Methods in com.google.common.cache that return ListenableFutureModifier and TypeMethodDescriptionComputes or retrieves a replacement value corresponding to an already-cachedkey
. -
Uses of ListenableFuture in com.google.common.util.concurrent
Subinterfaces of ListenableFuture in com.google.common.util.concurrentModifier and TypeInterfaceDescriptioninterface
ListenableScheduledFuture<V extends @Nullable Object>
Helper interface to implement bothListenableFuture
andScheduledFuture
.Classes in com.google.common.util.concurrent that implement ListenableFutureModifier and TypeClassDescriptionclass
AbstractFuture<V extends @Nullable Object>
An abstract implementation ofListenableFuture
, intended for advanced users only.class
FluentFuture<V extends @Nullable Object>
AListenableFuture
that supports fluent chains of operations.class
ForwardingListenableFuture<V extends @Nullable Object>
AListenableFuture
which forwards all its method calls to another future.static class
A simplified version ofForwardingListenableFuture
where subclasses can pass in an already constructedListenableFuture
as the delegate.class
ListenableFutureTask<V extends @Nullable Object>
AFutureTask
that also implements theListenableFuture
interface.final class
SettableFuture<V extends @Nullable Object>
AListenableFuture
whose result can be set by aSettableFuture.set(Object)
,SettableFuture.setException(Throwable)
orSettableFuture.setFuture(ListenableFuture)
call.Methods in com.google.common.util.concurrent that return ListenableFutureModifier and TypeMethodDescriptionstatic <V extends @Nullable Object>
ListenableFuture<List<V>> Futures.allAsList
(ListenableFuture<? extends V>... futures) Creates a newListenableFuture
whose value is a list containing the values of all its input futures, if all succeed.static <V extends @Nullable Object>
ListenableFuture<List<V>> Futures.allAsList
(Iterable<? extends ListenableFuture<? extends V>> futures) Creates a newListenableFuture
whose value is a list containing the values of all its input futures, if all succeed.Returns an outputFuture
to use in place of the giveninput
.AsyncCallable.call()
Computes a resultFuture
.<C extends @Nullable Object>
ListenableFuture<C> Creates theListenableFuture
which will return the result of callingCallable.call()
incombiner
when all futures complete, using the specifiedexecutor
.<C extends @Nullable Object>
ListenableFuture<C> Futures.FutureCombiner.callAsync
(AsyncCallable<C> combiner, Executor executor) Creates theListenableFuture
which will return the result of callingAsyncCallable.call()
incombiner
when all futures complete, using the specifiedexecutor
.static <V extends @Nullable Object, X extends Throwable>
ListenableFuture<V> Futures.catching
(ListenableFuture<? extends V> input, Class<X> exceptionType, Function<? super X, ? extends V> fallback, Executor executor) Returns aFuture
whose result is taken from the given primaryinput
or, if the primary input fails with the givenexceptionType
, from the result provided by thefallback
.static <V extends @Nullable Object, X extends Throwable>
ListenableFuture<V> Futures.catchingAsync
(ListenableFuture<? extends V> input, Class<X> exceptionType, AsyncFunction<? super X, ? extends V> fallback, Executor executor) Returns aFuture
whose result is taken from the given primaryinput
or, if the primary input fails with the givenexceptionType
, from the result provided by thefallback
.protected abstract ListenableFuture
<? extends V> ForwardingListenableFuture.delegate()
protected final ListenableFuture
<V> ForwardingListenableFuture.SimpleForwardingListenableFuture.delegate()
static <V extends @Nullable Object>
ListenableFuture<V> Futures.immediateCancelledFuture()
Creates aListenableFuture
which is cancelled immediately upon construction, so thatisCancelled()
always returnstrue
.static <V extends @Nullable Object>
ListenableFuture<V> Futures.immediateFailedFuture
(Throwable throwable) Returns aListenableFuture
which has an exception set immediately upon construction.static <V extends @Nullable Object>
ListenableFuture<V> Futures.immediateFuture
(V value) Creates aListenableFuture
which has its value set immediately upon construction.static ListenableFuture
<@Nullable Void> Futures.immediateVoidFuture()
Returns a successfulListenableFuture<Void>
.static <V extends @Nullable Object>
ListenableFuture<V> JdkFutureAdapters.listenInPoolThread
(Future<V> future) Assigns a thread to the givenFuture
to provideListenableFuture
functionality.static <V extends @Nullable Object>
ListenableFuture<V> JdkFutureAdapters.listenInPoolThread
(Future<V> future, Executor executor) Submits a blocking task for the givenFuture
to provideListenableFuture
functionality.static <V extends @Nullable Object>
ListenableFuture<V> Futures.nonCancellationPropagating
(ListenableFuture<V> future) Returns aListenableFuture
whose result is set from the supplied future when it completes.Creates theListenableFuture
which will return the result of runningcombiner
when all Futures complete.static <O extends @Nullable Object>
ListenableFuture<O> Futures.scheduleAsync
(AsyncCallable<O> callable, long delay, TimeUnit timeUnit, ScheduledExecutorService executorService) Schedulescallable
on the specifiedexecutor
, returning aFuture
.static <O extends @Nullable Object>
ListenableFuture<O> Futures.scheduleAsync
(AsyncCallable<O> callable, Duration delay, ScheduledExecutorService executorService) Schedulescallable
on the specifiedexecutor
, returning aFuture
.ClosingFuture.statusFuture()
Returns a future that finishes when this step does.<T extends @Nullable Object>
ListenableFuture<T> <T extends @Nullable Object>
ListenableFuture<T> <T extends @Nullable Object>
ListenableFuture<T> Enqueues a task to run when the previous task (if any) completes.<T extends @Nullable Object>
ListenableFuture<T> <T extends @Nullable Object>
ListenableFuture<T> static ListenableFuture
<@Nullable Void> Executesrunnable
on the specifiedexecutor
, returning aFuture
that will complete after execution.static <O extends @Nullable Object>
ListenableFuture<O> Executescallable
on the specifiedexecutor
, returning aFuture
.<T extends @Nullable Object>
ListenableFuture<T> <T extends @Nullable Object>
ListenableFuture<T> <T extends @Nullable Object>
ListenableFuture<T> ExecutionSequencer.submitAsync
(AsyncCallable<T> callable, Executor executor) Enqueues a task to run when the previous task (if any) completes.static <O extends @Nullable Object>
ListenableFuture<O> Futures.submitAsync
(AsyncCallable<O> callable, Executor executor) Executescallable
on the specifiedexecutor
, returning aFuture
.static <V extends @Nullable Object>
ListenableFuture<List<@Nullable V>> Futures.successfulAsList
(ListenableFuture<? extends V>... futures) Creates a newListenableFuture
whose value is a list containing the values of all its successful input futures.static <V extends @Nullable Object>
ListenableFuture<List<@Nullable V>> Futures.successfulAsList
(Iterable<? extends ListenableFuture<? extends V>> futures) Creates a newListenableFuture
whose value is a list containing the values of all its successful input futures.static <I extends @Nullable Object, O extends @Nullable Object>
ListenableFuture<O> Futures.transform
(ListenableFuture<I> input, Function<? super I, ? extends O> function, Executor executor) Returns a newFuture
whose result is derived from the result of the givenFuture
.static <I extends @Nullable Object, O extends @Nullable Object>
ListenableFuture<O> Futures.transformAsync
(ListenableFuture<I> input, AsyncFunction<? super I, ? extends O> function, Executor executor) Returns a newFuture
whose result is asynchronously derived from the result of the givenFuture
.static <V extends @Nullable Object>
ListenableFuture<V> Futures.withTimeout
(ListenableFuture<V> delegate, long time, TimeUnit unit, ScheduledExecutorService scheduledExecutor) Returns a future that delegates to another but will finish early (via aTimeoutException
wrapped in anExecutionException
) if the specified duration expires.static <V extends @Nullable Object>
ListenableFuture<V> Futures.withTimeout
(ListenableFuture<V> delegate, Duration time, ScheduledExecutorService scheduledExecutor) Returns a future that delegates to another but will finish early (via aTimeoutException
wrapped in anExecutionException
) if the specified duration expires.Methods in com.google.common.util.concurrent that return types with arguments of type ListenableFutureModifier and TypeMethodDescriptionstatic <T extends @Nullable Object>
ImmutableList<ListenableFuture<T>> Futures.inCompletionOrder
(Iterable<? extends ListenableFuture<? extends T>> futures) Returns a list of delegate futures that correspond to the futures received in the order that they complete.Methods in com.google.common.util.concurrent with parameters of type ListenableFutureModifier and TypeMethodDescriptionFutures.addCallback
(ListenableFuture<V> future, FutureCallback<? super V> callback, Executor executor) Registers separate success and failure callbacks to be run when theFuture
's computation is complete or, if the computation is already complete, immediately.static <V extends @Nullable Object>
ListenableFuture<List<V>> Futures.allAsList
(ListenableFuture<? extends V>... futures) Creates a newListenableFuture
whose value is a list containing the values of all its input futures, if all succeed.static <V extends @Nullable Object, X extends Throwable>
ListenableFuture<V> Futures.catching
(ListenableFuture<? extends V> input, Class<X> exceptionType, Function<? super X, ? extends V> fallback, Executor executor) Returns aFuture
whose result is taken from the given primaryinput
or, if the primary input fails with the givenexceptionType
, from the result provided by thefallback
.static <V extends @Nullable Object, X extends Throwable>
ListenableFuture<V> Futures.catchingAsync
(ListenableFuture<? extends V> input, Class<X> exceptionType, AsyncFunction<? super X, ? extends V> fallback, Executor executor) Returns aFuture
whose result is taken from the given primaryinput
or, if the primary input fails with the givenexceptionType
, from the result provided by thefallback
.static <C extends @Nullable Object & @Nullable AutoCloseable>
ClosingFuture<C> ClosingFuture.eventuallyClosing
(ListenableFuture<C> future, Executor closingExecutor) Deprecated.static <V extends @Nullable Object>
ClosingFuture<V> ClosingFuture.from
(ListenableFuture<V> future) Starts aClosingFuture
pipeline with aListenableFuture
.static <V extends @Nullable Object>
FluentFuture<V> FluentFuture.from
(ListenableFuture<V> future) Converts the givenListenableFuture
to an equivalentFluentFuture
.static <V extends @Nullable Object>
ListenableFuture<V> Futures.nonCancellationPropagating
(ListenableFuture<V> future) Returns aListenableFuture
whose result is set from the supplied future when it completes.protected boolean
AbstractFuture.setFuture
(ListenableFuture<? extends V> future) Sets the result of thisFuture
to match the supplied inputFuture
once the suppliedFuture
is done, unless thisFuture
has already been cancelled or set (including "set asynchronously," defined below).boolean
SettableFuture.setFuture
(ListenableFuture<? extends V> future) static <V extends @Nullable Object>
ListenableFuture<List<@Nullable V>> Futures.successfulAsList
(ListenableFuture<? extends V>... futures) Creates a newListenableFuture
whose value is a list containing the values of all its successful input futures.static <I extends @Nullable Object, O extends @Nullable Object>
ListenableFuture<O> Futures.transform
(ListenableFuture<I> input, Function<? super I, ? extends O> function, Executor executor) Returns a newFuture
whose result is derived from the result of the givenFuture
.static <I extends @Nullable Object, O extends @Nullable Object>
ListenableFuture<O> Futures.transformAsync
(ListenableFuture<I> input, AsyncFunction<? super I, ? extends O> function, Executor executor) Returns a newFuture
whose result is asynchronously derived from the result of the givenFuture
.static <V extends @Nullable Object>
Futures.FutureCombiner<V> Futures.whenAllComplete
(ListenableFuture<? extends V>... futures) Creates aFutures.FutureCombiner
that processes the completed futures whether or not they're successful.static <V extends @Nullable Object>
Futures.FutureCombiner<V> Futures.whenAllSucceed
(ListenableFuture<? extends V>... futures) Creates aFutures.FutureCombiner
requiring that all passed in futures are successful.static <V extends @Nullable Object>
ListenableFuture<V> Futures.withTimeout
(ListenableFuture<V> delegate, long time, TimeUnit unit, ScheduledExecutorService scheduledExecutor) Returns a future that delegates to another but will finish early (via aTimeoutException
wrapped in anExecutionException
) if the specified duration expires.static <V extends @Nullable Object>
ListenableFuture<V> Futures.withTimeout
(ListenableFuture<V> delegate, Duration time, ScheduledExecutorService scheduledExecutor) Returns a future that delegates to another but will finish early (via aTimeoutException
wrapped in anExecutionException
) if the specified duration expires.Method parameters in com.google.common.util.concurrent with type arguments of type ListenableFutureModifier and TypeMethodDescriptionstatic <V extends @Nullable Object>
ListenableFuture<List<V>> Futures.allAsList
(Iterable<? extends ListenableFuture<? extends V>> futures) Creates a newListenableFuture
whose value is a list containing the values of all its input futures, if all succeed.static <T extends @Nullable Object>
ImmutableList<ListenableFuture<T>> Futures.inCompletionOrder
(Iterable<? extends ListenableFuture<? extends T>> futures) Returns a list of delegate futures that correspond to the futures received in the order that they complete.static <V extends @Nullable Object>
ListenableFuture<List<@Nullable V>> Futures.successfulAsList
(Iterable<? extends ListenableFuture<? extends V>> futures) Creates a newListenableFuture
whose value is a list containing the values of all its successful input futures.static <V extends @Nullable Object>
Futures.FutureCombiner<V> Futures.whenAllComplete
(Iterable<? extends ListenableFuture<? extends V>> futures) Creates aFutures.FutureCombiner
that processes the completed futures whether or not they're successful.static <V extends @Nullable Object>
Futures.FutureCombiner<V> Futures.whenAllSucceed
(Iterable<? extends ListenableFuture<? extends V>> futures) Creates aFutures.FutureCombiner
requiring that all passed in futures are successful.Constructors in com.google.common.util.concurrent with parameters of type ListenableFutureModifierConstructorDescriptionprotected
SimpleForwardingListenableFuture
(ListenableFuture<V> delegate)
Future
s of closeable types is dangerous in general because the underlying value may never be closed if theFuture
is canceled after its operation begins.