Interface AsyncPromise<T>
-
- All Superinterfaces:
AsyncFuture<T>
,java.util.concurrent.CompletionStage<T>
,java.util.concurrent.Future<T>
- All Known Implementing Classes:
CancelledAsyncFuture
,DefaultAsyncFuture
,DefaultAsyncFutureTask
,DefaultCollectingAsyncFuture
,FailedAsyncFuture
,SuccessAsyncFuture
public interface AsyncPromise<T> extends AsyncFuture<T>
A completableAsyncFuture
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
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description AsyncPromise<T>
addListener(AsyncFutureListener<T> listener)
Adds the specified listener to this future.AsyncPromise<T>
addListener(AsyncPromise<T> listener)
Adds the specified future as a listener to this future.default void
setComplete(T value, java.lang.Throwable ex)
boolean
setFailure(java.lang.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, 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 Detail
-
addListener
@Nonnull AsyncPromise<T> addListener(@Nonnull AsyncFutureListener<T> listener)
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
@Nonnull AsyncPromise<T> addListener(@Nonnull AsyncPromise<T> listener)
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
boolean setSuccess(T result)
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
boolean setFailure(@Nonnull java.lang.Throwable cause)
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
default void setComplete(T value, java.lang.Throwable ex)
-
-