Interface Callback
- All Known Implementing Classes:
Callback.Completable
public interface Callback
A callback object that handles success/failure events of asynchronous operations.
NOTE: This interface is almost identical to org.eclipse.jetty.util.Callback
,
which however cannot be used in the Jetty WebSocket APIs for web application classloading
reasons.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault BiConsumer
<? super Void, ? super Throwable> Converts this callback into aBiConsumer
that can be passed toCompletableFuture.whenComplete(BiConsumer)
.default void
Method to invoke to fail the callback.static Callback
Creates a callback from the given success and failure lambdas.default void
succeed()
Method to invoke to succeed the callback.
-
Field Details
-
NOOP
Empty implementation.
-
-
Method Details
-
from
-
succeed
default void succeed()Method to invoke to succeed the callback.
- See Also:
-
fail
-
asBiConsumer
Converts this callback into a
BiConsumer
that can be passed toCompletableFuture.whenComplete(BiConsumer)
.When the
BiConsumer
is accepted, this callback is completed.- Returns:
- a
BiConsumer
that completes this callback - See Also:
-