C - the type of the context objectFuturePromise, Promise.Adapter, Promise.Completable, Promise.Wrapperpublic interface Promise<C>
A callback abstraction that handles completed/failed events of asynchronous operations.
| Modifier and Type | Interface | Description |
|---|---|---|
static class |
Promise.Adapter<U> |
Empty implementation of
Promise. |
static class |
Promise.Completable<S> |
A CompletableFuture that is also a Promise.
|
static class |
Promise.Wrapper<W> |
| Modifier and Type | Method | Description |
|---|---|---|
default void |
failed(java.lang.Throwable x) |
Callback invoked when the operation fails.
|
static <T> Promise<T> |
from(java.util.concurrent.CompletableFuture<? super T> completable) |
Creates a promise from the given incomplete CompletableFuture.
|
default void |
succeeded(C result) |
Callback invoked when the operation completes.
|
default void succeeded(C result)
Callback invoked when the operation completes.
result - the contextfailed(Throwable)default void failed(java.lang.Throwable x)
Callback invoked when the operation fails.
x - the reason for the operation failurestatic <T> Promise<T> from(java.util.concurrent.CompletableFuture<? super T> completable)
Creates a promise from the given incomplete CompletableFuture.
When the promise completes, either succeeding or failing, the
CompletableFuture is also completed, respectively via
CompletableFuture.complete(Object) or
CompletableFuture.completeExceptionally(Throwable).
T - the type of the resultcompletable - the CompletableFuture to convert into a promiseCopyright © 1995–2018 Webtide. All rights reserved.