Interface AsyncPromise<T>

All Superinterfaces:
AsyncFuture<T>, CompletionStage<T>, Future<T>
All Known Implementing Classes:
CancelledAsyncFuture, DefaultAsyncFuture, DefaultAsyncFutureTask, DefaultCollectingAsyncFuture, FailedAsyncFuture, SuccessAsyncFuture

public interface AsyncPromise<T> extends AsyncFuture<T>
A completable AsyncFuture interface.
  • Method Details

    • 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 interface AsyncFuture<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 interface AsyncFuture<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. Otherwise false because this future is already marked as either a success or a failure.
    • setFailure

      boolean setFailure(@Nonnull 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. Otherwise false because this future is already marked as either a success or a failure.
    • setComplete

      default void setComplete(T value, Throwable ex)