Package | Description |
---|---|
com.google.common.cache |
This package contains caching utilities.
|
com.google.common.util.concurrent |
Concurrency utilities.
|
Modifier and Type | Method and Description |
---|---|
ListenableFuture<V> |
CacheLoader.reload(K key,
V oldValue)
Computes or retrieves a replacement value corresponding to an already-cached
key . |
Modifier and Type | Interface and Description |
---|---|
interface |
ListenableScheduledFuture<V>
Helper interface to implement both
ListenableFuture and ScheduledFuture . |
Modifier and Type | Class and Description |
---|---|
class |
AbstractFuture<V>
An abstract implementation of
ListenableFuture , intended for advanced users only. |
class |
FluentFuture<V>
A
ListenableFuture that supports fluent chains of operations. |
class |
ForwardingListenableFuture<V>
A
ListenableFuture which forwards all its method calls to another future. |
static class |
ForwardingListenableFuture.SimpleForwardingListenableFuture<V>
A simplified version of
ForwardingListenableFuture where subclasses can pass in an
already constructed ListenableFuture as the delegate. |
class |
ListenableFutureTask<V>
A
FutureTask that also implements the ListenableFuture interface. |
class |
SettableFuture<V>
A
ListenableFuture whose result can be set by a SettableFuture.set(Object) , SettableFuture.setException(Throwable) or SettableFuture.setFuture(ListenableFuture) call. |
Modifier and Type | Method and Description |
---|---|
static <V> ListenableFuture<List<V>> |
Futures.allAsList(Iterable<? extends ListenableFuture<? extends V>> futures)
Creates a new
ListenableFuture whose value is a list containing the values of all its
input futures, if all succeed. |
static <V> ListenableFuture<List<V>> |
Futures.allAsList(ListenableFuture<? extends V>... futures)
Creates a new
ListenableFuture whose value is a list containing the values of all its
input futures, if all succeed. |
ListenableFuture<O> |
AsyncFunction.apply(I input)
Returns an output
Future to use in place of the given input . |
ListenableFuture<V> |
AsyncCallable.call()
Computes a result
Future . |
<C> ListenableFuture<C> |
Futures.FutureCombiner.call(Callable<C> combiner,
Executor executor)
Creates the
ListenableFuture which will return the result of calling Callable.call() in combiner when all futures complete, using the specified executor . |
<C> ListenableFuture<C> |
Futures.FutureCombiner.callAsync(AsyncCallable<C> combiner,
Executor executor)
Creates the
ListenableFuture which will return the result of calling AsyncCallable.call() in combiner when all futures complete, using the specified executor . |
static <V,X extends Throwable> |
Futures.catching(ListenableFuture<? extends V> input,
Class<X> exceptionType,
Function<? super X,? extends V> fallback,
Executor executor)
Returns a
Future whose result is taken from the given primary input or, if the
primary input fails with the given exceptionType , from the result provided by the
fallback . |
static <V,X extends Throwable> |
Futures.catchingAsync(ListenableFuture<? extends V> input,
Class<X> exceptionType,
AsyncFunction<? super X,? extends V> fallback,
Executor executor)
Returns a
Future whose result is taken from the given primary input or, if the
primary input fails with the given exceptionType , from the result provided by the
fallback . |
protected abstract ListenableFuture<? extends V> |
ForwardingListenableFuture.delegate() |
protected ListenableFuture<V> |
ForwardingListenableFuture.SimpleForwardingListenableFuture.delegate() |
static <V> ListenableFuture<V> |
Futures.immediateCancelledFuture()
Creates a
ListenableFuture which is cancelled immediately upon construction, so that
isCancelled() always returns true . |
static <V> ListenableFuture<V> |
Futures.immediateFailedFuture(Throwable throwable)
Returns a
ListenableFuture which has an exception set immediately upon construction. |
static <V> ListenableFuture<V> |
Futures.immediateFuture(V value)
Creates a
ListenableFuture which has its value set immediately upon construction. |
static <V> ListenableFuture<V> |
JdkFutureAdapters.listenInPoolThread(Future<V> future)
Assigns a thread to the given
Future to provide ListenableFuture functionality. |
static <V> ListenableFuture<V> |
JdkFutureAdapters.listenInPoolThread(Future<V> future,
Executor executor)
Submits a blocking task for the given
Future to provide ListenableFuture
functionality. |
static <V> ListenableFuture<V> |
Futures.nonCancellationPropagating(ListenableFuture<V> future)
Returns a
ListenableFuture whose result is set from the supplied future when it
completes. |
ListenableFuture<?> |
Futures.FutureCombiner.run(Runnable combiner,
Executor executor)
Creates the
ListenableFuture which will return the result of running combiner
when all Futures complete. |
static <O> ListenableFuture<O> |
Futures.scheduleAsync(AsyncCallable<O> callable,
Duration delay,
ScheduledExecutorService executorService)
Schedules
callable on the specified executor , returning a Future . |
static <O> ListenableFuture<O> |
Futures.scheduleAsync(AsyncCallable<O> callable,
long delay,
TimeUnit timeUnit,
ScheduledExecutorService executorService)
Schedules
callable on the specified executor , returning a Future . |
<T> ListenableFuture<T> |
ForwardingListeningExecutorService.submit(Callable<T> task) |
<T> ListenableFuture<T> |
ListeningExecutorService.submit(Callable<T> task) |
<T> ListenableFuture<T> |
AbstractListeningExecutorService.submit(Callable<T> task) |
<T> ListenableFuture<T> |
ExecutionSequencer.submit(Callable<T> callable,
Executor executor)
Enqueues a task to run when the previous task (if any) completes.
|
ListenableFuture<?> |
ForwardingListeningExecutorService.submit(Runnable task) |
ListenableFuture<?> |
ListeningExecutorService.submit(Runnable task) |
ListenableFuture<?> |
AbstractListeningExecutorService.submit(Runnable task) |
<T> ListenableFuture<T> |
ForwardingListeningExecutorService.submit(Runnable task,
T result) |
<T> ListenableFuture<T> |
ListeningExecutorService.submit(Runnable task,
T result) |
<T> ListenableFuture<T> |
AbstractListeningExecutorService.submit(Runnable task,
T result) |
static <O> ListenableFuture<O> |
Futures.submitAsync(AsyncCallable<O> callable,
Executor executor)
Executes
callable on the specified executor , returning a Future . |
<T> ListenableFuture<T> |
ExecutionSequencer.submitAsync(AsyncCallable<T> callable,
Executor executor)
Enqueues a task to run when the previous task (if any) completes.
|
static <V> ListenableFuture<List<V>> |
Futures.successfulAsList(Iterable<? extends ListenableFuture<? extends V>> futures)
Creates a new
ListenableFuture whose value is a list containing the values of all its
successful input futures. |
static <V> ListenableFuture<List<V>> |
Futures.successfulAsList(ListenableFuture<? extends V>... futures)
Creates a new
ListenableFuture 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 new
Future whose result is derived from the result of the given Future . |
static <I,O> ListenableFuture<O> |
Futures.transformAsync(ListenableFuture<I> input,
AsyncFunction<? super I,? extends O> function,
Executor executor)
Returns a new
Future whose result is asynchronously derived from the result of the
given Future . |
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 a
TimeoutException wrapped in an ExecutionException ) if the specified duration expires. |
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 a
TimeoutException wrapped in an ExecutionException ) if the specified duration expires. |
Modifier and Type | Method and Description |
---|---|
static <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.
|
Modifier and Type | Method and Description |
---|---|
static <V> void |
Futures.addCallback(ListenableFuture<V> future,
FutureCallback<? super V> callback,
Executor executor)
Registers separate success and failure callbacks to be run when the
Future 's
computation is complete or, if the
computation is already complete, immediately. |
static <V> ListenableFuture<List<V>> |
Futures.allAsList(ListenableFuture<? extends V>... futures)
Creates a new
ListenableFuture whose value is a list containing the values of all its
input futures, if all succeed. |
static <V,X extends Throwable> |
Futures.catching(ListenableFuture<? extends V> input,
Class<X> exceptionType,
Function<? super X,? extends V> fallback,
Executor executor)
Returns a
Future whose result is taken from the given primary input or, if the
primary input fails with the given exceptionType , from the result provided by the
fallback . |
static <V,X extends Throwable> |
Futures.catchingAsync(ListenableFuture<? extends V> input,
Class<X> exceptionType,
AsyncFunction<? super X,? extends V> fallback,
Executor executor)
Returns a
Future whose result is taken from the given primary input or, if the
primary input fails with the given exceptionType , from the result provided by the
fallback . |
static <V> FluentFuture<V> |
FluentFuture.from(ListenableFuture<V> future)
Converts the given
ListenableFuture to an equivalent FluentFuture . |
static <V> ListenableFuture<V> |
Futures.nonCancellationPropagating(ListenableFuture<V> future)
Returns a
ListenableFuture whose result is set from the supplied future when it
completes. |
protected boolean |
AbstractFuture.setFuture(ListenableFuture<? extends V> future)
Sets the result of this
Future to match the supplied input Future once the
supplied Future is done, unless this Future has already been cancelled or set
(including "set asynchronously," defined below). |
boolean |
SettableFuture.setFuture(ListenableFuture<? extends V> future) |
static <V> ListenableFuture<List<V>> |
Futures.successfulAsList(ListenableFuture<? extends V>... futures)
Creates a new
ListenableFuture 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 new
Future whose result is derived from the result of the given Future . |
static <I,O> ListenableFuture<O> |
Futures.transformAsync(ListenableFuture<I> input,
AsyncFunction<? super I,? extends O> function,
Executor executor)
Returns a new
Future whose result is asynchronously derived from the result of the
given Future . |
static <V> Futures.FutureCombiner<V> |
Futures.whenAllComplete(ListenableFuture<? extends V>... futures)
Creates a
Futures.FutureCombiner that processes the completed futures whether or not they're
successful. |
static <V> Futures.FutureCombiner<V> |
Futures.whenAllSucceed(ListenableFuture<? extends V>... futures)
Creates a
Futures.FutureCombiner requiring that all passed in futures are successful. |
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 a
TimeoutException wrapped in an ExecutionException ) if the specified duration expires. |
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 a
TimeoutException wrapped in an ExecutionException ) if the specified duration expires. |
Modifier and Type | Method and Description |
---|---|
static <V> ListenableFuture<List<V>> |
Futures.allAsList(Iterable<? extends ListenableFuture<? extends V>> futures)
Creates a new
ListenableFuture whose value is a list containing the values of all its
input futures, if all succeed. |
static <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 new
ListenableFuture 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 a
Futures.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 a
Futures.FutureCombiner requiring that all passed in futures are successful. |
Constructor and Description |
---|
SimpleForwardingListenableFuture(ListenableFuture<V> delegate) |
Copyright © 2010–2019. All rights reserved.