Package org.apache.flink.util.concurrent
Class FutureUtils.ConjunctFuture<T>
- java.lang.Object
-
- java.util.concurrent.CompletableFuture<T>
-
- org.apache.flink.util.concurrent.FutureUtils.ConjunctFuture<T>
-
- All Implemented Interfaces:
CompletionStage<T>,Future<T>
- Enclosing class:
- FutureUtils
public abstract static class FutureUtils.ConjunctFuture<T> extends CompletableFuture<T>
A future that is complete once multiple other futures completed. The futures are not necessarily of the same type. The ConjunctFuture fails (completes exceptionally) once one of the Futures in the conjunction fails.The advantage of using the ConjunctFuture over chaining all the futures (such as via
CompletableFuture.thenCombine(CompletionStage, BiFunction)) is that ConjunctFuture also tracks how many of the Futures are already complete.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.concurrent.CompletableFuture
CompletableFuture.AsynchronousCompletionTask
-
-
Constructor Summary
Constructors Constructor Description ConjunctFuture()
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract intgetNumFuturesCompleted()Gets the number of Futures in the conjunction that are already complete.abstract intgetNumFuturesTotal()Gets the total number of Futures in the conjunction.-
Methods inherited from class java.util.concurrent.CompletableFuture
acceptEither, acceptEitherAsync, acceptEitherAsync, allOf, anyOf, applyToEither, applyToEitherAsync, applyToEitherAsync, cancel, complete, completeAsync, completeAsync, completedFuture, completedStage, completeExceptionally, completeOnTimeout, copy, defaultExecutor, delayedExecutor, delayedExecutor, exceptionally, failedFuture, failedStage, get, get, getNow, getNumberOfDependents, handle, handleAsync, handleAsync, isCancelled, isCompletedExceptionally, isDone, join, minimalCompletionStage, newIncompleteFuture, obtrudeException, obtrudeValue, orTimeout, runAfterBoth, runAfterBothAsync, runAfterBothAsync, runAfterEither, runAfterEitherAsync, runAfterEitherAsync, runAsync, runAsync, supplyAsync, supplyAsync, thenAccept, thenAcceptAsync, thenAcceptAsync, thenAcceptBoth, thenAcceptBothAsync, thenAcceptBothAsync, thenApply, thenApplyAsync, thenApplyAsync, thenCombine, thenCombineAsync, thenCombineAsync, thenCompose, thenComposeAsync, thenComposeAsync, thenRun, thenRunAsync, thenRunAsync, toCompletableFuture, toString, whenComplete, whenCompleteAsync, whenCompleteAsync
-
-
-
-
Method Detail
-
getNumFuturesTotal
public abstract int getNumFuturesTotal()
Gets the total number of Futures in the conjunction.- Returns:
- The total number of Futures in the conjunction.
-
getNumFuturesCompleted
public abstract int getNumFuturesCompleted()
Gets the number of Futures in the conjunction that are already complete.- Returns:
- The number of Futures in the conjunction that are already complete
-
-