Interface AsyncPromise<T>
- All Superinterfaces:
AsyncFuture<T>,CompletionStage<T>,Future<T>
- All Known Implementing Classes:
CancelledAsyncFuture,DefaultAsyncFuture,DefaultAsyncFutureTask,DefaultCollectingAsyncFuture,FailedAsyncFuture,SuccessAsyncFuture
A completable
AsyncFuture interface.-
Nested Class Summary
Nested classes/interfaces inherited from interface com.linkedin.alpini.base.concurrency.AsyncFuture
AsyncFuture.Status -
Field Summary
Fields inherited from interface com.linkedin.alpini.base.concurrency.AsyncFuture
NULL_SUCCESS -
Method Summary
Modifier and TypeMethodDescriptionaddListener(AsyncFutureListener<T> listener) Adds the specified listener to this future.addListener(AsyncPromise<T> listener) Adds the specified future as a listener to this future.default voidsetComplete(T value, Throwable ex) booleansetFailure(Throwable cause) Marks this future as a failure and notifies all listeners.booleansetSuccess(T result) Marks this future as a success and notifies all listeners.Methods inherited from interface com.linkedin.alpini.base.concurrency.AsyncFuture
await, await, awaitUninterruptibly, awaitUninterruptibly, getCause, getNow, isSuccessMethods inherited from interface java.util.concurrent.CompletionStage
acceptEither, acceptEitherAsync, acceptEitherAsync, applyToEither, applyToEitherAsync, applyToEitherAsync, exceptionally, exceptionallyAsync, exceptionallyAsync, exceptionallyCompose, exceptionallyComposeAsync, exceptionallyComposeAsync, handle, handleAsync, handleAsync, runAfterBoth, runAfterBothAsync, runAfterBothAsync, runAfterEither, runAfterEitherAsync, runAfterEitherAsync, thenAccept, thenAcceptAsync, thenAcceptAsync, thenAcceptBoth, thenAcceptBothAsync, thenAcceptBothAsync, thenApply, thenApplyAsync, thenApplyAsync, thenCombine, thenCombineAsync, thenCombineAsync, thenCompose, thenComposeAsync, thenComposeAsync, thenRun, thenRunAsync, thenRunAsync, toCompletableFuture, whenComplete, whenCompleteAsync, whenCompleteAsync
-
Method Details
-
addListener
Adds the specified listener to this future. The specified listener is notified when this future is done. If this future is already completed, the specified listener is notified immediately.- Specified by:
addListenerin interfaceAsyncFuture<T>- Returns:
thisto permit chaining of operations.
-
addListener
Adds the specified future as a listener to this future. The specified future is notified when this future is done. If this future is already completed, the specified future is notified immediately.- Specified by:
addListenerin interfaceAsyncFuture<T>- Parameters:
listener-- Returns:
thisto permit chaining of operations.
-
setSuccess
Marks this future as a success and notifies all listeners.- Returns:
trueif and only if successfully marked this future as a success. Otherwisefalsebecause this future is already marked as either a success or a failure.
-
setFailure
Marks this future as a failure and notifies all listeners.- Returns:
trueif and only if successfully marked this future as a failure. Otherwisefalsebecause this future is already marked as either a success or a failure.
-
setComplete
-