Package io.atomix.utils.concurrent
Class ComposableFuture<T>
- java.lang.Object
-
- java.util.concurrent.CompletableFuture<T>
-
- io.atomix.utils.concurrent.ComposableFuture<T>
-
- All Implemented Interfaces:
CompletionStage<T>,Future<T>,BiConsumer<T,Throwable>
public class ComposableFuture<T> extends CompletableFuture<T> implements BiConsumer<T,Throwable>
Special implementation ofCompletableFuturewith missing utility methods.- Author:
- Jordan Halterman
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.concurrent.CompletableFuture
CompletableFuture.AsynchronousCompletionTask
-
-
Constructor Summary
Constructors Constructor Description ComposableFuture()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(T result, Throwable error)CompletableFuture<T>except(Consumer<Throwable> consumer)Sets a consumer to be called when the future is failed.CompletableFuture<T>exceptAsync(Consumer<Throwable> consumer)Sets a consumer to be called asynchronously when the future is failed.CompletableFuture<T>exceptAsync(Consumer<Throwable> consumer, Executor executor)Sets a consumer to be called asynchronously when the future is failed.-
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
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.function.BiConsumer
andThen
-
-
-
-
Method Detail
-
accept
public void accept(T result, Throwable error)
- Specified by:
acceptin interfaceBiConsumer<T,Throwable>
-
except
public CompletableFuture<T> except(Consumer<Throwable> consumer)
Sets a consumer to be called when the future is failed.- Parameters:
consumer- The consumer to call.- Returns:
- A new future.
-
exceptAsync
public CompletableFuture<T> exceptAsync(Consumer<Throwable> consumer)
Sets a consumer to be called asynchronously when the future is failed.- Parameters:
consumer- The consumer to call.- Returns:
- A new future.
-
exceptAsync
public CompletableFuture<T> exceptAsync(Consumer<Throwable> consumer, Executor executor)
Sets a consumer to be called asynchronously when the future is failed.- Parameters:
consumer- The consumer to call.executor- The executor with which to call the consumer.- Returns:
- A new future.
-
-