C
- the type of the context objectpublic interface Promise<C>
A callback abstraction that handles completed/failed events of asynchronous operations.
Modifier and Type | Interface and 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 and Description |
---|---|
default void |
failed(Throwable x)
Callback invoked when the operation fails.
|
static <T> Promise<T> |
from(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(Throwable x)
Callback invoked when the operation fails.
x
- the reason for the operation failurestatic <T> Promise<T> from(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 © 2010 - 2020 Adobe. All Rights Reserved