Class Promise.Completable<S>

java.lang.Object
java.util.concurrent.CompletableFuture<S>
org.eclipse.jetty.util.Promise.Completable<S>
Type Parameters:
S - the type of the result
All Implemented Interfaces:
CompletionStage<S>, Future<S>, Promise<S>
Enclosing interface:
Promise<C>

public static class Promise.Completable<S> extends CompletableFuture<S> implements Promise<S>

A CompletableFuture that is also a Promise.

  • Constructor Details

    • Completable

      public Completable()
  • Method Details

    • with

      public static <R> Promise.Completable<R> with(Consumer<Promise<R>> consumer)

      Creates a new Completable to be consumed by the given consumer, then returns the newly created Completable.

      Type Parameters:
      R - the type of the result
      Parameters:
      consumer - the code that consumes the newly created Completable
      Returns:
      the newly created Completable
    • succeeded

      public void succeeded(S result)
      Description copied from interface: Promise

      Callback invoked when the operation completes.

      Specified by:
      succeeded in interface Promise<S>
      Parameters:
      result - the context
      See Also:
    • failed

      public void failed(Throwable x)
      Description copied from interface: Promise

      Callback invoked when the operation fails.

      Specified by:
      failed in interface Promise<S>
      Parameters:
      x - the reason for the operation failure