InvocableCallback.Completable, Callback.Nested, CompletableCallback, CountingCallback, FutureCallback, IteratingCallback, IteratingNestedCallback, SharedBlockingCallback.Blockerpublic interface Callback extends Invocable
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
| Modifier and Type | Interface | Description |
|---|---|---|
static class |
Callback.Completable |
A CompletableFuture that is also a Callback.
|
static class |
Callback.Nested |
Invocable.InvocationType| Modifier and Type | Field | Description |
|---|---|---|
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.
|
__nonBlocking| Modifier and Type | Method | Description |
|---|---|---|
default void |
failed(java.lang.Throwable x) |
Callback invoked when the operation fails.
|
static Callback |
from(java.util.concurrent.CompletableFuture<?> completable) |
Creates a non-blocking callback from the given incomplete CompletableFuture.
|
static Callback |
from(java.util.concurrent.CompletableFuture<?> completable,
Invocable.InvocationType invocation) |
Creates a callback from the given incomplete CompletableFuture,
with the given
blocking characteristic. |
default void |
succeeded() |
Callback invoked when the operation completes.
|
asPreferred, getInvocationType, getInvocationType, invokeNonBlocking, invokePreferNonBlocking, invokePreferred, isNonBlockingInvocationstatic final Callback NOOP
default void succeeded()
Callback invoked when the operation completes.
failed(Throwable)default void failed(java.lang.Throwable x)
Callback invoked when the operation fails.
x - the reason for the operation failurestatic Callback from(java.util.concurrent.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(java.util.concurrent.CompletableFuture<?> completable, Invocable.InvocationType invocation)
Creates a callback from the given incomplete CompletableFuture,
with the given blocking characteristic.
completable - the CompletableFuture to convert into a callbackinvocation - whether the callback is blockingCopyright © 1995–2017 Webtide. All rights reserved.