public interface Callback
A callback abstraction that handles completed/failed events of asynchronous operations.
Semantically this is equivalent to an optimise Promise<Void>, but callback is a more meaningful name than EmptyPromise
| 限定符和类型 | 接口和说明 |
|---|---|
static class |
Callback.Completable
A CompletableFuture that is also a Callback.
|
static class |
Callback.Nested |
static interface |
Callback.NonBlocking
Callback interface that declares itself as non-blocking
|
| 限定符和类型 | 字段和说明 |
|---|---|
static Callback |
NOOP
Instance of Adapter that can be used when the callback methods need an
empty implementation without incurring in the cost of allocating a new
Adapter object.
|
| 限定符和类型 | 方法和说明 |
|---|---|
default void |
failed(Throwable x)
Callback invoked when the operation fails.
|
static Callback |
from(CompletableFuture<?> completable)
Creates a non-blocking callback from the given incomplete
CompletableFuture.
|
static Callback |
from(CompletableFuture<?> completable,
boolean blocking)
Creates a callback from the given incomplete CompletableFuture, with the
given
blocking characteristic. |
default boolean |
isNonBlocking() |
default void |
succeeded()
Callback invoked when the operation completes.
|
static final Callback NOOP
default void succeeded()
Callback invoked when the operation completes.
failed(Throwable)default void failed(Throwable x)
Callback invoked when the operation fails.
x - the reason for the operation failuredefault boolean isNonBlocking()
static Callback from(CompletableFuture<?> completable)
Creates a non-blocking callback from the given incomplete CompletableFuture.
When the callback completes, either succeeding or failing, the
CompletableFuture is also completed, respectively via
CompletableFuture.complete(Object) or
CompletableFuture.completeExceptionally(Throwable).
completable - the CompletableFuture to convert into a callbackstatic Callback from(CompletableFuture<?> completable, boolean blocking)
Creates a callback from the given incomplete CompletableFuture, with the
given blocking characteristic.
completable - the CompletableFuture to convert into a callbackblocking - whether the callback is blockingCopyright © 2016. All rights reserved.