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 | Class and Description |
|---|---|
| public static class | Callback.Completable
A |
| public static interface | Callback.Completing
A Callback implementation that calls the |
| public static class | Callback.Nested
Nested Completing Callback that completes after completing the nested callback |
| Modifier and Type | Field and Description |
|---|---|
| public static final 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.
|
| Modifier and Type | Method and Description |
|---|---|
| public static Callback | |
| public default void | completeWith(CompletableFuture<?>
the CompletableFuture that completes this callback completable)Completes this callback with the given |
| public default void | |
| public static Callback | Returns: a callback that when completed, completes the given CompletableFuturethe CompletableFuture to convert into a callback completable)Creates a non-blocking callback from the given incomplete CompletableFuture. |
| public static Callback | Returns: a callback that when completed, completes the given CompletableFuturethe CompletableFuture to convert into a callback completable, Invocable.whether the callback is blocking invocationCreates a callback from the given incomplete CompletableFuture,
with the given |
| public static Callback | |
| public static Callback | |
| public static Callback | |
| public static Callback | Returns: a new Callback with the given invocation typethe invocation type of the returned Callback invocationType,the Runnable to run when the callback either succeeds or fails completed)Hides org. Creates a Callback with the given |
| public static Callback | |
| public static Callback | |
| public static Callback | Returns: a new callback.The completion to run before the nested callback is completed. Any exceptions thrown
from completed will result in a callback failure. completed, Callback The nested callback callback)Creates a nested callback that runs completed before completing the nested callback. |
| public static Callback | |
| public static Callback | |
| public default void |
| NOOP | back to summary |
|---|---|
| public static final Callback NOOP Hides org. 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. | |
| combine | back to summary |
|---|---|
| public static Callback combine(Callback cb1, Callback cb2) | |
| completeWith | back to summary |
|---|---|
| public default void completeWith(CompletableFuture<?> completable) Completes this callback with the given When the CompletableFuture completes normally, this callback is succeeded; when the CompletableFuture completes exceptionally, this callback is failed.
| |
| failed | back to summary |
|---|---|
| public default void failed(Throwable x) Callback invoked when the operation fails.
| |
| from | back to summary |
|---|---|
| public 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
| |
| from | back to summary |
|---|---|
| public static Callback from(CompletableFuture<?> completable, Invocable. Creates a callback from the given incomplete CompletableFuture,
with the given
| |
| from | back to summary |
|---|---|
| public static Callback from(Runnable success, Consumer<Throwable> failure) Creates a callback from the given success and failure lambdas. | |
| from | back to summary |
|---|---|
| public static Callback from(Invocable. Creates a callback with the given InvocationType from the given success and failure lambdas. | |
| from | back to summary |
|---|---|
| public static Callback from(Runnable completed) Creates a callback that runs completed when it succeeds or fails | |
| from | back to summary |
|---|---|
| public static Callback from(Invocable. Hides org. Creates a Callback with the given
| |
| from | back to summary |
|---|---|
| public static Callback from(Callback callback, Runnable completed) Creates a nested callback that runs completed after completing the nested callback. | |
| from | back to summary |
|---|---|
| public static Callback from(Callback callback, Consumer<Throwable> completed) Creates a nested callback that runs completed after completing the nested callback. | |
| from | back to summary |
|---|---|
| public static Callback from(Runnable completed, Callback callback) Creates a nested callback that runs completed before completing the nested callback. | |
| from | back to summary |
|---|---|
| public static Callback from(Callback callback, Throwable cause) Creates a nested callback which always fails the nested callback on completion. | |
| from | back to summary |
|---|---|
| public static Callback from(Callback callback1, Callback callback2) Creates a callback which combines two other callbacks and will succeed or fail them both. | |
| succeeded | back to summary |
|---|---|
| public default void succeeded() Callback invoked when the operation completes.
| |
A CompletableFuture that is also a Callback.
| Modifier and Type | Field and Description |
|---|---|
| private final Invocable. |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Callback. | Returns: a newCompletable passed to the consumerthe consumer that receives the consumerCompletableReturns a new |
| public void | failed(Throwable
the reason for the operation failure x)Overrides default org. Callback invoked when the operation fails. |
| public static Callback. | |
| public Invocable. | |
| public void | succeeded()
Overrides default org. Callback invoked when the operation completes. |
| public static Callback. | Returns: the newly createdCompletablethe code that consumes the newly created consumerCompletableCreates a new |
| invocation | back to summary |
|---|---|
| private final Invocable. | |
| Completable | back to summary |
|---|---|
| public Completable() | |
| Completable | back to summary |
|---|---|
| public Completable(Invocable. | |
| compose | back to summary |
|---|---|
| public Callback. Returns a new If this
| |
| failed | back to summary |
|---|---|
| public void failed(Throwable x) Overrides default org. Doc from org. Callback invoked when the operation fails. | |
| from | back to summary |
|---|---|
| public static Callback. Creates a completable future given a callback.
| |
| getInvocationType | back to summary |
|---|---|
| public Invocable. Overrides default org.
| |
| succeeded | back to summary |
|---|---|
| public void succeeded() Overrides default org. Doc from org. Callback invoked when the operation completes.
| |
| with | back to summary |
|---|---|
| public static Callback. Creates a new
| |
A Callback implementation that calls the completed() method when it either succeeds or fails.
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public default void | failed(Throwable
the reason for the operation failure x)Overrides default org. Callback invoked when the operation fails. |
| public default void | succeeded()
Overrides default org. Callback invoked when the operation completes. |
| completed | back to summary |
|---|---|
| public void completed() | |
| failed | back to summary |
|---|---|
| public default void failed(Throwable x) Overrides default org. Doc from org. Callback invoked when the operation fails. | |
| succeeded | back to summary |
|---|---|
| public default void succeeded() Overrides default org. Doc from org. Callback invoked when the operation completes.
| |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | failed(Throwable
the reason for the operation failure x)Overrides default org. Callback invoked when the operation fails. |
| public Callback | |
| public Invocable. | |
| public void | succeeded()
Overrides default org. Callback invoked when the operation completes. |
| public String |
| callback | back to summary |
|---|---|
| private final Callback callback | |
| Nested | back to summary |
|---|---|
| public Nested(Callback callback) | |
| completed | back to summary |
|---|---|
| public void completed() Implements org.
| |
| failed | back to summary |
|---|---|
| public void failed(Throwable x) Overrides default org. Doc from org. Callback invoked when the operation fails. | |
| getCallback | back to summary |
|---|---|
| public Callback getCallback() | |
| getInvocationType | back to summary |
|---|---|
| public Invocable. Overrides default org.
| |
| succeeded | back to summary |
|---|---|
| public void succeeded() Overrides default org. Doc from org. Callback invoked when the operation completes.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |