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 void
setComplete
(T value, Throwable ex) boolean
setFailure
(Throwable cause) Marks this future as a failure and notifies all listeners.boolean
setSuccess
(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, isSuccess
Methods 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:
addListener
in interfaceAsyncFuture<T>
- Returns:
this
to 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:
addListener
in interfaceAsyncFuture<T>
- Parameters:
listener
-- Returns:
this
to permit chaining of operations.
-
setSuccess
Marks this future as a success and notifies all listeners.- Returns:
true
if and only if successfully marked this future as a success. Otherwisefalse
because this future is already marked as either a success or a failure.
-
setFailure
Marks this future as a failure and notifies all listeners.- Returns:
true
if and only if successfully marked this future as a failure. Otherwisefalse
because this future is already marked as either a success or a failure.
-
setComplete
-