@Beta @CanIgnoreReturnValue @GwtCompatible public static final class Futures.FutureCombiner<V> extends Object
ListenableFuture whose result is generated from a combination
 of input futures.
 See Futures.whenAllComplete(com.google.common.util.concurrent.ListenableFuture<? extends V>...) and Futures.whenAllSucceed(com.google.common.util.concurrent.ListenableFuture<? extends V>...) for how to instantiate this class.
 
Example:
 final ListenableFuture<Instant> loginDateFuture =
     loginService.findLastLoginDate(username);
 final ListenableFuture<List<String>> recentCommandsFuture =
     recentCommandsService.findRecentCommands(username);
 Callable<UsageHistory> usageComputation =
     new Callable<UsageHistory>() {
       public UsageHistory call() throws Exception {
         return new UsageHistory(
             username, loginDateFuture.get(), recentCommandsFuture.get());
       }
     };
 ListenableFuture<UsageHistory> usageFuture =
     Futures.whenAllSucceed(loginDateFuture, recentCommandsFuture)
         .call(usageComputation, executor);
 | Modifier and Type | Method and Description | 
|---|---|
<C> ListenableFuture<C> | 
call(Callable<C> combiner)
Deprecated. 
 
Use the overload that requires an
     executor. For identical behavior, pass  
MoreExecutors.directExecutor(), but
     consider whether another executor would be safer, as discussed in the ListenableFuture.addListener documentation. This method is
     scheduled to be removed in July 2018. | 
<C> ListenableFuture<C> | 
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> | 
callAsync(AsyncCallable<C> combiner)
Deprecated. 
 
Use the overload that requires an
     executor. For identical behavior, pass  
MoreExecutors.directExecutor(), but
     consider whether another executor would be safer, as discussed in the ListenableFuture.addListener documentation. This method is
     scheduled to be removed in July 2018. | 
<C> ListenableFuture<C> | 
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. | 
ListenableFuture<?> | 
run(Runnable combiner,
   Executor executor)
Creates the  
ListenableFuture which will return the result of running combiner
 when all Futures complete. | 
public <C> ListenableFuture<C> callAsync(AsyncCallable<C> combiner, Executor executor)
ListenableFuture which will return the result of calling AsyncCallable.call() in combiner when all futures complete, using the specified executor.
 If the combiner throws a CancellationException, the returned future will be
 cancelled.
 
If the combiner throws an ExecutionException, the cause of the thrown ExecutionException will be extracted and returned as the cause of the new ExecutionException that gets thrown by the returned combined future.
 
Canceling this future will attempt to cancel all the component futures.
@Deprecated public <C> ListenableFuture<C> callAsync(AsyncCallable<C> combiner)
MoreExecutors.directExecutor(), but
     consider whether another executor would be safer, as discussed in the ListenableFuture.addListener documentation. This method is
     scheduled to be removed in July 2018.callAsync(AsyncCallable, Executor) but using direct executor.@CanIgnoreReturnValue public <C> ListenableFuture<C> call(Callable<C> combiner, Executor executor)
ListenableFuture which will return the result of calling Callable.call() in combiner when all futures complete, using the specified executor.
 If the combiner throws a CancellationException, the returned future will be
 cancelled.
 
If the combiner throws an ExecutionException, the cause of the thrown ExecutionException will be extracted and returned as the cause of the new ExecutionException that gets thrown by the returned combined future.
 
Canceling this future will attempt to cancel all the component futures.
@CanIgnoreReturnValue @Deprecated public <C> ListenableFuture<C> call(Callable<C> combiner)
MoreExecutors.directExecutor(), but
     consider whether another executor would be safer, as discussed in the ListenableFuture.addListener documentation. This method is
     scheduled to be removed in July 2018.call(Callable, Executor) but using direct executor.public ListenableFuture<?> run(Runnable combiner, Executor executor)
ListenableFuture which will return the result of running combiner
 when all Futures complete. combiner will run using executor.
 If the combiner throws a CancellationException, the returned future will be
 cancelled.
 
Canceling this Future will attempt to cancel all the component futures.
Copyright © 2010–2018. All rights reserved.