Class Futures.FutureCombiner<V extends @Nullable java.lang.Object>

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <C extends @Nullable java.lang.Object>
      ListenableFuture<C>
      call​(java.util.concurrent.Callable<C> combiner, java.util.concurrent.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 extends @Nullable java.lang.Object>
      ListenableFuture<C>
      callAsync​(AsyncCallable<C> combiner, java.util.concurrent.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​(java.lang.Runnable combiner, java.util.concurrent.Executor executor)
      Creates the ListenableFuture which will return the result of running combiner when all Futures complete.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • callAsync

        public <C extends @Nullable java.lang.Object> ListenableFuture<C> callAsync​(AsyncCallable<C> combiner,
                                                                                    java.util.concurrent.Executor executor)
        Creates the 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.

        Returns:
        a future whose result is based on combiner (or based on the input futures passed to whenAllSucceed, if that is the method you used to create this FutureCombiner). Even if you don't care about the value of the future, you should typically check whether it failed: See https://errorprone.info/bugpattern/FutureReturnValueIgnored.
      • call

        public <C extends @Nullable java.lang.Object> ListenableFuture<C> call​(java.util.concurrent.Callable<C> combiner,
                                                                               java.util.concurrent.Executor executor)
        Creates the 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.

        Returns:
        a future whose result is based on combiner (or based on the input futures passed to whenAllSucceed, if that is the method you used to create this FutureCombiner). Even if you don't care about the value of the future, you should typically check whether it failed: See https://errorprone.info/bugpattern/FutureReturnValueIgnored.
      • run

        public ListenableFuture<?> run​(java.lang.Runnable combiner,
                                       java.util.concurrent.Executor executor)
        Creates the 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.

        Returns:
        a future whose result is based on combiner (or based on the input futures passed to whenAllSucceed, if that is the method you used to create this FutureCombiner). Even though the future never produces a value other than null, you should typically check whether it failed: See https://errorprone.info/bugpattern/FutureReturnValueIgnored.
        Since:
        23.6