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 aBiConsumerthat can be passed toCompletableFuture.whenComplete(BiConsumer).default voidMethod to invoke to fail the callback.static CallbackCreates a callback from the given success and failure lambdas.default voidsucceed()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
BiConsumerthat can be passed toCompletableFuture.whenComplete(BiConsumer).When the
BiConsumeris accepted, this callback is completed.- Returns:
- a
BiConsumerthat completes this callback - See Also:
-