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 TypeMethodDescriptionprivate ListenableFuture
<V> LocalCache.LoadingValueReference.fullyFailedFuture
(Throwable t) (package private) ListenableFuture
<V> LocalCache.Segment.loadAsync
(K key, int hash, LocalCache.LoadingValueReference<K, V> loadingValueReference, CacheLoader<? super K, V> loader) LocalCache.LoadingValueReference.loadFuture
(K key, CacheLoader<? super K, V> loader) Computes or retrieves a replacement value corresponding to an already-cachedkey
.Methods in com.google.common.cache with parameters of type ListenableFutureModifier and TypeMethodDescription(package private) V
LocalCache.Segment.getAndRecordStats
(K key, int hash, LocalCache.LoadingValueReference<K, V> loadingValueReference, ListenableFuture<V> newValue) Waits uninterruptibly fornewValue
to be loaded, and then records loading stats. -
Uses of ListenableFuture in com.google.common.util.concurrent
Subinterfaces of ListenableFuture in com.google.common.util.concurrentModifier and TypeInterfaceDescription(package private) static interface
Tag interface marking trusted subclasses.interface
Helper interface to implement bothListenableFuture
andScheduledFuture
.Classes in com.google.common.util.concurrent that implement ListenableFutureModifier and TypeClassDescription(package private) class
AbstractCatchingFuture<V,
X extends Throwable, F, T> Implementations ofFutures.catching*
.private static final class
AbstractCatchingFuture.AsyncCatchingFuture<V,
X extends Throwable> AnAbstractCatchingFuture
that delegates to anAsyncFunction
andAbstractFuture.setFuture(ListenableFuture)
.private static final class
AbstractCatchingFuture.CatchingFuture<V,
X extends Throwable> class
An abstract implementation ofListenableFuture
, intended for advanced users only.(package private) static class
A less abstract subclass of AbstractFuture.(package private) class
AbstractTransformFuture<I,
O, F, T> Implementations ofFutures.transform*
.private static final class
AnAbstractTransformFuture
that delegates to anAsyncFunction
andAbstractFuture.setFuture(ListenableFuture)
.private static final class
(package private) class
AggregateFuture<InputT,
OutputT> A future whose value is derived from a collection of input futures.(package private) class
AggregateFutureState<OutputT>
A helper which does some thread-safe operations for aggregate futures, which must be implemented differently in GWT.(package private) class
CollectionFuture<V,
C> Aggregate future that collects (stores) results of each future.(package private) static final class
(package private) final class
Aggregate future that computes its value by calling a callable.class
FluentFuture<V>
AListenableFuture
that supports fluent chains of operations.(package private) static class
A less abstract subclass of AbstractFuture.(package private) final class
FluentFuture
that forwards all calls to a delegate.class
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.private static final class
private static final class
A wrapped future that does not propagate cancellation to its delegate.(package private) class
Hidden superclass ofFluentFuture
that provides us a place to declare special GWT versions of theinvalid reference
FluentFuture.catching
(package private) class
Implementation ofFutures.immediateFuture(V)
.(package private) static final class
(package private) static final class
private static class
An adapter to turn aFuture
into aListenableFuture
.class
AFutureTask
that also implements theListenableFuture
interface.private static final class
private static final class
final class
AListenableFuture
whose result can be set by aSettableFuture.set(Object)
,SettableFuture.setException(Throwable)
orSettableFuture.setFuture(ListenableFuture)
call.(package private) final class
Implementation ofFutures#withTimeout
.(package private) class
ARunnableFuture
that also implements theListenableFuture
interface.Fields in com.google.common.util.concurrent declared as ListenableFutureModifier and TypeFieldDescriptionprivate final ListenableFuture
<V> ForwardingFluentFuture.delegate
private final ListenableFuture
<V> ForwardingListenableFuture.SimpleForwardingListenableFuture.delegate
private ListenableFuture
<V> Futures.NonCancellationPropagatingFuture.delegate
private ListenableFuture
<V> TimeoutFuture.delegateRef
(package private) final ListenableFuture
<? extends V> AbstractFuture.SetFuture.future
(package private) ListenableFuture
<? extends V> AbstractCatchingFuture.inputFuture
(package private) ListenableFuture
<? extends I> AbstractTransformFuture.inputFuture
private final ListenableFuture<? extends T>[]
Futures.InCompletionOrderState.inputFutures
(package private) static final ListenableFuture
<?> ImmediateFuture.NULL
Fields in com.google.common.util.concurrent with type parameters of type ListenableFutureModifier and TypeFieldDescriptionprivate ImmutableCollection
<? extends ListenableFuture<? extends InputT>> AggregateFuture.futures
The input futures.private final ImmutableList
<ListenableFuture<? extends V>> Futures.FutureCombiner.futures
private final AtomicReference
<ListenableFuture<Void>> ExecutionSequencer.ref
This reference acts as a pointer tracking the head of a linked list of ListenableFutures.Methods in com.google.common.util.concurrent that return ListenableFutureModifier and TypeMethodDescriptionstatic <V> 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> 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
.(package private) <V,
U> ListenableFuture <U> ClosingFuture.CloseableList.applyClosingFunction
(ClosingFuture.ClosingFunction<? super V, U> transformation, V input) AsyncCallable.call()
Computes a resultFuture
.<C> ListenableFuture
<C> Creates theListenableFuture
which will return the result of callingCallable.call()
incombiner
when all futures complete, using the specifiedexecutor
.<C> 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,
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,
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
.(package private) static <V,
X extends Throwable>
ListenableFuture<V> AbstractCatchingFuture.create
(ListenableFuture<? extends V> input, Class<X> exceptionType, Function<? super X, ? extends V> fallback, Executor executor) (package private) static <I,
O> ListenableFuture <O> AbstractTransformFuture.create
(ListenableFuture<I> input, Function<? super I, ? extends O> function, Executor executor) (package private) static <V> ListenableFuture
<V> TimeoutFuture.create
(ListenableFuture<V> delegate, long time, TimeUnit unit, ScheduledExecutorService scheduledExecutor) (package private) static <X extends Throwable,
V>
ListenableFuture<V> AbstractCatchingFuture.createAsync
(ListenableFuture<? extends V> input, Class<X> exceptionType, AsyncFunction<? super X, ? extends V> fallback, Executor executor) (package private) static <I,
O> ListenableFuture <O> AbstractTransformFuture.createAsync
(ListenableFuture<I> input, AsyncFunction<? super I, ? extends O> function, Executor executor) protected abstract ListenableFuture
<? extends V> ForwardingListenableFuture.delegate()
protected final ListenableFuture
<V> ForwardingListenableFuture.SimpleForwardingListenableFuture.delegate()
(package private) ListenableFuture
<? extends V> AbstractCatchingFuture.AsyncCatchingFuture.doFallback
(AsyncFunction<? super X, ? extends V> fallback, X cause) (package private) ListenableFuture
<? extends O> AbstractTransformFuture.AsyncTransformFuture.doTransform
(AsyncFunction<? super I, ? extends O> function, I input) private static <T> ListenableFuture<? extends T>[]
Futures.gwtCompatibleToArray
(Iterable<? extends ListenableFuture<? extends T>> futures) Can't use Iterables.toArray because it's not gwt compatiblestatic <V> ListenableFuture
<V> Futures.immediateCancelledFuture()
Creates aListenableFuture
which is cancelled immediately upon construction, so thatisCancelled()
always returnstrue
.static <V> ListenableFuture
<V> Futures.immediateFailedFuture
(Throwable throwable) Returns aListenableFuture
which has an exception set immediately upon construction.static <V> ListenableFuture
<V> Futures.immediateFuture
(V value) Creates aListenableFuture
which has its value set immediately upon construction.static ListenableFuture
<Void> Futures.immediateVoidFuture()
Returns a successfulListenableFuture<Void>
.static <V> ListenableFuture
<V> JdkFutureAdapters.listenInPoolThread
(Future<V> future) Assigns a thread to the givenFuture
to provideListenableFuture
functionality.static <V> ListenableFuture
<V> JdkFutureAdapters.listenInPoolThread
(Future<V> future, Executor executor) Submits a blocking task for the givenFuture
to provideListenableFuture
functionality.static <V> 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.(package private) ListenableFuture
<V> CombinedFuture.AsyncCallableInterruptibleTask.runInterruptibly()
(package private) ListenableFuture
<V> TrustedListenableFutureTask.TrustedFutureInterruptibleAsyncTask.runInterruptibly()
static <O> ListenableFuture
<O> Futures.scheduleAsync
(AsyncCallable<O> callable, long delay, TimeUnit timeUnit, ScheduledExecutorService executorService) Schedulescallable
on the specifiedexecutor
, returning aFuture
.static <O> 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> ListenableFuture
<T> <T> ListenableFuture
<T> <T> ListenableFuture
<T> Enqueues a task to run when the previous task (if any) completes.<T> ListenableFuture
<T> <T> ListenableFuture
<T> static ListenableFuture
<Void> Executesrunnable
on the specifiedexecutor
, returning aFuture
that will complete after execution.static <O> ListenableFuture
<O> Executescallable
on the specifiedexecutor
, returning aFuture
.<T> ListenableFuture
<T> <T> ListenableFuture
<T> private static <T> ListenableFuture
<T> MoreExecutors.submitAndAddQueueListener
(ListeningExecutorService executorService, Callable<T> task, BlockingQueue<Future<T>> queue) Submits the task and adds a listener that adds the future toqueue
when it completes.<T> ListenableFuture
<T> ExecutionSequencer.submitAsync
(AsyncCallable<T> callable, Executor executor) Enqueues a task to run when the previous task (if any) completes.static <O> ListenableFuture
<O> Futures.submitAsync
(AsyncCallable<O> callable, Executor executor) Executescallable
on the specifiedexecutor
, returning aFuture
.static <V> ListenableFuture
<List<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> ListenableFuture
<List<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,
O> 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,
O> 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> 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> 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> 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 TypeMethodDescriptionstatic <V> void
Futures.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.(package private) void
TrustedListenableFutureTask.TrustedFutureInterruptibleAsyncTask.afterRanInterruptiblySuccess
(ListenableFuture<V> result) static <V> 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,
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,
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
.(package private) static <V,
X extends Throwable>
ListenableFuture<V> AbstractCatchingFuture.create
(ListenableFuture<? extends V> input, Class<X> exceptionType, Function<? super X, ? extends V> fallback, Executor executor) (package private) static <I,
O> ListenableFuture <O> AbstractTransformFuture.create
(ListenableFuture<I> input, Function<? super I, ? extends O> function, Executor executor) (package private) static <V> ListenableFuture
<V> TimeoutFuture.create
(ListenableFuture<V> delegate, long time, TimeUnit unit, ScheduledExecutorService scheduledExecutor) (package private) static <X extends Throwable,
V>
ListenableFuture<V> AbstractCatchingFuture.createAsync
(ListenableFuture<? extends V> input, Class<X> exceptionType, AsyncFunction<? super X, ? extends V> fallback, Executor executor) (package private) static <I,
O> ListenableFuture <O> AbstractTransformFuture.createAsync
(ListenableFuture<I> input, AsyncFunction<? super I, ? extends O> function, Executor executor) static <C extends Object & AutoCloseable>
ClosingFuture<C> ClosingFuture.eventuallyClosing
(ListenableFuture<C> future, Executor closingExecutor) Deprecated.static <V> ClosingFuture
<V> ClosingFuture.from
(ListenableFuture<V> future) Starts aClosingFuture
pipeline with aListenableFuture
.static <V> FluentFuture
<V> FluentFuture.from
(ListenableFuture<V> future) Converts the givenListenableFuture
to an equivalentFluentFuture
.private static Object
AbstractFuture.getFutureValue
(ListenableFuture<?> future) Returns a value that satisfies the contract of theAbstractFuture.value
field based on the state of given future.static <V> ListenableFuture
<V> Futures.nonCancellationPropagating
(ListenableFuture<V> future) Returns aListenableFuture
whose result is set from the supplied future when it completes.private void
AggregateFuture.processAllMustSucceedDoneFuture
(int index, ListenableFuture<? extends InputT> future) 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) (package private) void
AbstractCatchingFuture.AsyncCatchingFuture.setResult
(ListenableFuture<? extends V> result) (package private) void
AbstractTransformFuture.AsyncTransformFuture.setResult
(ListenableFuture<? extends O> result) (package private) void
CombinedFuture.AsyncCallableInterruptibleTask.setValue
(ListenableFuture<V> value) static <V> ListenableFuture
<List<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,
O> 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,
O> 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> 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> Futures.FutureCombiner
<V> Futures.whenAllSucceed
(ListenableFuture<? extends V>... futures) Creates aFutures.FutureCombiner
requiring that all passed in futures are successful.static <V> 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> 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> 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.private static <T> ListenableFuture<? extends T>[]
Futures.gwtCompatibleToArray
(Iterable<? extends ListenableFuture<? extends T>> futures) Can't use Iterables.toArray because it's not gwt compatiblestatic <T> 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> ListenableFuture
<List<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> 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> 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 ListenableFutureModifierConstructorDescription(package private)
AbstractCatchingFuture
(ListenableFuture<? extends V> inputFuture, Class<X> exceptionType, F fallback) (package private)
AbstractTransformFuture
(ListenableFuture<? extends I> inputFuture, F function) (package private)
AsyncCatchingFuture
(ListenableFuture<? extends V> input, Class<X> exceptionType, AsyncFunction<? super X, ? extends V> fallback) (package private)
AsyncTransformFuture
(ListenableFuture<? extends I> inputFuture, AsyncFunction<? super I, ? extends O> function) (package private)
CatchingFuture
(ListenableFuture<? extends V> input, Class<X> exceptionType, Function<? super X, ? extends V> fallback) private
ClosingFuture
(ListenableFuture<V> future) private
ClosingFuture
(ListenableFuture<V> future, ClosingFuture.CloseableList closeables) (package private)
ForwardingFluentFuture
(ListenableFuture<V> delegate) private
InCompletionOrderState
(ListenableFuture<? extends T>[] inputFutures) ListenableScheduledTask
(ListenableFuture<V> listenableDelegate, ScheduledFuture<?> scheduledDelegate) (package private)
NonCancellationPropagatingFuture
(ListenableFuture<V> delegate) (package private)
SetFuture
(AbstractFuture<V> owner, ListenableFuture<? extends V> future) protected
SimpleForwardingListenableFuture
(ListenableFuture<V> delegate) private
TimeoutFuture
(ListenableFuture<V> delegate) (package private)
TransformFuture
(ListenableFuture<? extends I> inputFuture, Function<? super I, ? extends O> function) Constructor parameters in com.google.common.util.concurrent with type arguments of type ListenableFutureModifierConstructorDescription(package private)
AggregateFuture
(ImmutableCollection<? extends ListenableFuture<? extends InputT>> futures, boolean allMustSucceed, boolean collectsValues) (package private)
CollectionFuture
(ImmutableCollection<? extends ListenableFuture<? extends V>> futures, boolean allMustSucceed) (package private)
CombinedFuture
(ImmutableCollection<? extends ListenableFuture<?>> futures, boolean allMustSucceed, Executor listenerExecutor, AsyncCallable<V> callable) (package private)
CombinedFuture
(ImmutableCollection<? extends ListenableFuture<?>> futures, boolean allMustSucceed, Executor listenerExecutor, Callable<V> callable) private
FutureCombiner
(boolean allMustSucceed, ImmutableList<ListenableFuture<? extends V>> futures) (package private)
ListFuture
(ImmutableCollection<? extends ListenableFuture<? extends V>> futures, boolean allMustSucceed) -
Uses of ListenableFuture in com.google.common.util.concurrent.testing
Classes in com.google.common.util.concurrent.testing that implement ListenableFutureModifier and TypeClassDescriptionprivate static final class
private static class
Fields in com.google.common.util.concurrent.testing declared as ListenableFutureModifier and TypeFieldDescriptionprotected ListenableFuture
<Boolean> AbstractListenableFutureTest.future
private final ListenableFuture
<?> MockFutureListener.future
Methods in com.google.common.util.concurrent.testing that return ListenableFutureModifier and TypeMethodDescriptionprotected abstract <V> ListenableFuture
<V> AbstractListenableFutureTest.createListenableFuture
(V value, Exception except, CountDownLatch waitOn) Constructs a listenable future with a value available after the latch has counted down.<T> ListenableFuture
<T> <T> ListenableFuture
<T> Constructors in com.google.common.util.concurrent.testing with parameters of type ListenableFutureModifierConstructorDescription(package private)
ImmediateScheduledFuture
(ListenableFuture<V> future) MockFutureListener
(ListenableFuture<?> future)
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.