Package | Description |
---|---|
com.google.common.cache |
This package contains caching utilities.
|
com.google.common.util.concurrent |
Concurrency utilities.
|
Modifier and Type | Method and Description |
---|---|
private ListenableFuture<V> |
LocalCache.LoadingValueReference.fullyFailedFuture(java.lang.Throwable t) |
(package private) ListenableFuture<V> |
LocalCache.Segment.loadAsync(K key,
int hash,
LocalCache.LoadingValueReference<K,V> loadingValueReference,
CacheLoader<? super K,V> loader) |
ListenableFuture<V> |
LocalCache.LoadingValueReference.loadFuture(K key,
CacheLoader<? super K,V> loader) |
ListenableFuture<V> |
CacheLoader.reload(K key,
V oldValue)
Computes or retrieves a replacement value corresponding to an already-cached
key . |
Modifier and Type | Method and Description |
---|---|
(package private) V |
LocalCache.Segment.getAndRecordStats(K key,
int hash,
LocalCache.LoadingValueReference<K,V> loadingValueReference,
ListenableFuture<V> newValue)
Waits uninterruptibly for
newValue to be loaded, and then records loading stats. |
Modifier and Type | Interface and Description |
---|---|
interface |
CheckedFuture<V,X extends java.lang.Exception>
A
CheckedFuture is a ListenableFuture that includes versions
of the get methods that can throw a checked exception. |
interface |
ListenableScheduledFuture<V>
Helper interface to implement both
ListenableFuture and
ScheduledFuture . |
Modifier and Type | Class and Description |
---|---|
class |
AbstractCheckedFuture<V,X extends java.lang.Exception>
A delegating wrapper around a
ListenableFuture that adds support for
the AbstractCheckedFuture.checkedGet() and AbstractCheckedFuture.checkedGet(long, TimeUnit) methods. |
class |
AbstractFuture<V>
An abstract implementation of the
ListenableFuture interface. |
(package private) class |
AsyncSettableFuture<V>
A settable future that can be set asynchronously via
AsyncSettableFuture.setFuture(com.google.common.util.concurrent.ListenableFuture<? extends V>) . |
private static class |
AsyncSettableFuture.NestedFuture<V> |
class |
ForwardingCheckedFuture<V,X extends java.lang.Exception>
A future which forwards all its method calls to another future.
|
static class |
ForwardingCheckedFuture.SimpleForwardingCheckedFuture<V,X extends java.lang.Exception>
A simplified version of
ForwardingCheckedFuture where subclasses
can pass in an already constructed CheckedFuture as the delegate. |
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. |
private static class |
Futures.ChainingListenableFuture<I,O>
An implementation of
ListenableFuture that also implements
Runnable so that it can be used to nest ListenableFutures. |
private static class |
Futures.CombinedFuture<V,C> |
private static class |
Futures.CombinerFuture<V> |
private static class |
Futures.FallbackFuture<V>
A future that falls back on a second, generated future, in case its
original future fails.
|
private static class |
Futures.ImmediateCancelledFuture<V> |
private static class |
Futures.ImmediateFailedCheckedFuture<V,X extends java.lang.Exception> |
private static class |
Futures.ImmediateFailedFuture<V> |
private static class |
Futures.ImmediateFuture<V> |
private static class |
Futures.ImmediateSuccessfulCheckedFuture<V,X extends java.lang.Exception> |
private static class |
Futures.ImmediateSuccessfulFuture<V> |
private static class |
Futures.MappingCheckedFuture<V,X extends java.lang.Exception>
A checked future that uses a function to map from exceptions to the
appropriate checked type.
|
private static class |
Futures.NonCancellationPropagatingFuture<V>
A wrapped future that does not propagate cancellation to its delegate.
|
private static class |
JdkFutureAdapters.ListenableFutureAdapter<V>
An adapter to turn a
Future into a ListenableFuture . |
class |
ListenableFutureTask<V>
A
FutureTask that also implements the ListenableFuture
interface. |
private static class |
MoreExecutors.ScheduledListeningDecorator.ListenableScheduledTask<V> |
private static class |
MoreExecutors.ScheduledListeningDecorator.NeverSuccessfulListenableFutureTask |
class |
SettableFuture<V>
A
ListenableFuture whose result may be set by a SettableFuture.set(Object)
or SettableFuture.setException(Throwable) call. |
Modifier and Type | Field and Description |
---|---|
private ListenableFuture<V> |
ForwardingListenableFuture.SimpleForwardingListenableFuture.delegate |
private ListenableFuture<V> |
AsyncSettableFuture.dereferenced |
private ListenableFuture<? extends I> |
Futures.ChainingListenableFuture.inputFuture |
private ListenableFuture<? extends O> |
Futures.ChainingListenableFuture.outputFuture |
private ListenableFuture<? extends V> |
Futures.FallbackFuture.running |
Modifier and Type | Field and Description |
---|---|
private static AsyncFunction<ListenableFuture<java.lang.Object>,java.lang.Object> |
Futures.DEREFERENCER
|
(package private) ImmutableList<ListenableFuture<?>> |
Futures.CombinerFuture.futures |
(package private) ImmutableCollection<? extends ListenableFuture<? extends V>> |
Futures.CombinedFuture.futures |
Modifier and Type | Method and Description |
---|---|
static <V> ListenableFuture<java.util.List<V>> |
Futures.allAsList(java.lang.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<java.util.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> |
FutureFallback.create(java.lang.Throwable t)
Returns a
Future to be used in place of the Future that
failed with the given exception. |
protected ListenableFuture<V> |
AsyncSettableFuture.delegate() |
protected abstract ListenableFuture<V> |
ForwardingListenableFuture.delegate() |
protected ListenableFuture<V> |
ForwardingListenableFuture.SimpleForwardingListenableFuture.delegate() |
static <V> ListenableFuture<V> |
Futures.dereference(ListenableFuture<? extends ListenableFuture<? extends V>> nested)
Returns a new
ListenableFuture whose result is the product of
calling get() on the Future nested within the given Future , effectively chaining the futures one after the other. |
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(java.lang.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(java.util.concurrent.Future<V> future)
Assigns a thread to the given
Future to provide ListenableFuture functionality. |
static <V> ListenableFuture<V> |
JdkFutureAdapters.listenInPoolThread(java.util.concurrent.Future<V> future,
java.util.concurrent.Executor executor)
Submits a blocking task for the given
Future to provide ListenableFuture functionality. |
private static <V> ListenableFuture<java.util.List<V>> |
Futures.listFuture(ImmutableList<ListenableFuture<? extends V>> futures,
boolean allMustSucceed,
java.util.concurrent.Executor listenerExecutor)
|
static <V> ListenableFuture<V> |
Futures.nonCancellationPropagating(ListenableFuture<V> future)
Creates a new
ListenableFuture whose result is set from the
supplied future when it completes. |
<T> ListenableFuture<T> |
AbstractListeningExecutorService.submit(java.util.concurrent.Callable<T> task) |
<T> ListenableFuture<T> |
ForwardingListeningExecutorService.submit(java.util.concurrent.Callable<T> task) |
<T> ListenableFuture<T> |
ListeningExecutorService.submit(java.util.concurrent.Callable<T> task) |
ListenableFuture<?> |
AbstractListeningExecutorService.submit(java.lang.Runnable task) |
ListenableFuture<?> |
ForwardingListeningExecutorService.submit(java.lang.Runnable task) |
ListenableFuture<?> |
ListeningExecutorService.submit(java.lang.Runnable task) |
<T> ListenableFuture<T> |
AbstractListeningExecutorService.submit(java.lang.Runnable task,
T result) |
<T> ListenableFuture<T> |
ForwardingListeningExecutorService.submit(java.lang.Runnable task,
T result) |
<T> ListenableFuture<T> |
ListeningExecutorService.submit(java.lang.Runnable task,
T result) |
private static <T> ListenableFuture<T> |
MoreExecutors.submitAndAddQueueListener(ListeningExecutorService executorService,
java.util.concurrent.Callable<T> task,
java.util.concurrent.BlockingQueue<java.util.concurrent.Future<T>> queue)
Submits the task and adds a listener that adds the future to
queue when it completes. |
static <V> ListenableFuture<java.util.List<V>> |
Futures.successfulAsList(java.lang.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<java.util.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,
AsyncFunction<? super I,? extends O> function)
Returns a new
ListenableFuture whose result is asynchronously
derived from the result of the given Future . |
static <I,O> ListenableFuture<O> |
Futures.transform(ListenableFuture<I> input,
AsyncFunction<? super I,? extends O> function,
java.util.concurrent.Executor executor)
Returns a new
ListenableFuture whose result is asynchronously
derived from the result of the given Future . |
static <I,O> ListenableFuture<O> |
Futures.transform(ListenableFuture<I> input,
Function<? super I,? extends O> function)
Returns a new
ListenableFuture whose result is the product of
applying the given Function to the result of the given Future . |
static <I,O> ListenableFuture<O> |
Futures.transform(ListenableFuture<I> input,
Function<? super I,? extends O> function,
java.util.concurrent.Executor executor)
Returns a new
ListenableFuture whose result is the product of
applying the given Function to the result of the given Future . |
static <V> ListenableFuture<V> |
Futures.withFallback(ListenableFuture<? extends V> input,
FutureFallback<? extends V> fallback)
Returns a
Future whose result is taken from the given primary
input or, if the primary input fails, from the Future
provided by the fallback . |
static <V> ListenableFuture<V> |
Futures.withFallback(ListenableFuture<? extends V> input,
FutureFallback<? extends V> fallback,
java.util.concurrent.Executor executor)
Returns a
Future whose result is taken from the given primary
input or, if the primary input fails, from the Future
provided by the fallback . |
Modifier and Type | Method and Description |
---|---|
static <T> ImmutableList<ListenableFuture<T>> |
Futures.inCompletionOrder(java.lang.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)
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> void |
Futures.addCallback(ListenableFuture<V> future,
FutureCallback<? super V> callback,
java.util.concurrent.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<java.util.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> ListenableFuture<V> |
Futures.dereference(ListenableFuture<? extends ListenableFuture<? extends V>> nested)
Returns a new
ListenableFuture whose result is the product of
calling get() on the Future nested within the given Future , effectively chaining the futures one after the other. |
static <V,X extends java.lang.Exception> |
Futures.makeChecked(ListenableFuture<V> future,
Function<? super java.lang.Exception,X> mapper)
Creates a
CheckedFuture out of a normal ListenableFuture
and a Function that maps from Exception instances into the
appropriate checked type. |
static <V> ListenableFuture<V> |
Futures.nonCancellationPropagating(ListenableFuture<V> future)
Creates a new
ListenableFuture whose result is set from the
supplied future when it completes. |
boolean |
AsyncSettableFuture.setFuture(ListenableFuture<? extends V> future)
Sets this future to forward to the given future.
|
(package private) boolean |
AsyncSettableFuture.NestedFuture.setFuture(ListenableFuture<? extends V> value) |
static <V> ListenableFuture<java.util.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,
AsyncFunction<? super I,? extends O> function)
Returns a new
ListenableFuture whose result is asynchronously
derived from the result of the given Future . |
static <I,O> ListenableFuture<O> |
Futures.transform(ListenableFuture<I> input,
AsyncFunction<? super I,? extends O> function,
java.util.concurrent.Executor executor)
Returns a new
ListenableFuture whose result is asynchronously
derived from the result of the given Future . |
static <I,O> ListenableFuture<O> |
Futures.transform(ListenableFuture<I> input,
Function<? super I,? extends O> function)
Returns a new
ListenableFuture whose result is the product of
applying the given Function to the result of the given Future . |
static <I,O> ListenableFuture<O> |
Futures.transform(ListenableFuture<I> input,
Function<? super I,? extends O> function,
java.util.concurrent.Executor executor)
Returns a new
ListenableFuture whose result is the product of
applying the given Function to the result of the given Future . |
static <V> ListenableFuture<V> |
Futures.withFallback(ListenableFuture<? extends V> input,
FutureFallback<? extends V> fallback)
Returns a
Future whose result is taken from the given primary
input or, if the primary input fails, from the Future
provided by the fallback . |
static <V> ListenableFuture<V> |
Futures.withFallback(ListenableFuture<? extends V> input,
FutureFallback<? extends V> fallback,
java.util.concurrent.Executor executor)
Returns a
Future whose result is taken from the given primary
input or, if the primary input fails, from the Future
provided by the fallback . |
Modifier and Type | Method and Description |
---|---|
static <V> ListenableFuture<java.util.List<V>> |
Futures.allAsList(java.lang.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<V> |
Futures.dereference(ListenableFuture<? extends ListenableFuture<? extends V>> nested)
Returns a new
ListenableFuture whose result is the product of
calling get() on the Future nested within the given Future , effectively chaining the futures one after the other. |
static <T> ImmutableList<ListenableFuture<T>> |
Futures.inCompletionOrder(java.lang.Iterable<? extends ListenableFuture<? extends T>> futures)
Returns a list of delegate futures that correspond to the futures received in the order
that they complete.
|
private static <V> ListenableFuture<java.util.List<V>> |
Futures.listFuture(ImmutableList<ListenableFuture<? extends V>> futures,
boolean allMustSucceed,
java.util.concurrent.Executor listenerExecutor)
|
static <V> ListenableFuture<java.util.List<V>> |
Futures.successfulAsList(java.lang.Iterable<? extends ListenableFuture<? extends V>> futures)
Creates a new
ListenableFuture whose value is a list containing the
values of all its successful input futures. |
Constructor and Description |
---|
AbstractCheckedFuture(ListenableFuture<V> delegate)
Constructs an
AbstractCheckedFuture that wraps a delegate. |
ChainingListenableFuture(AsyncFunction<? super I,? extends O> function,
ListenableFuture<? extends I> inputFuture) |
FallbackFuture(ListenableFuture<? extends V> input,
FutureFallback<? extends V> fallback,
java.util.concurrent.Executor executor) |
ListenableScheduledTask(ListenableFuture<V> listenableDelegate,
java.util.concurrent.ScheduledFuture<?> scheduledDelegate) |
MappingCheckedFuture(ListenableFuture<V> delegate,
Function<? super java.lang.Exception,X> mapper) |
NonCancellationPropagatingFuture(ListenableFuture<V> delegate) |
SimpleForwardingListenableFuture(ListenableFuture<V> delegate) |
Constructor and Description |
---|
CombinedFuture(ImmutableCollection<? extends ListenableFuture<? extends V>> futures,
boolean allMustSucceed,
java.util.concurrent.Executor listenerExecutor,
Futures.FutureCombiner<V,C> combiner) |
CombinerFuture(java.util.concurrent.Callable<V> callable,
ImmutableList<ListenableFuture<?>> futures) |