PersistentTasksService.WaitForPersistentTaskStatusListener<Params>
AdapterActionFuture
, ContextPreservingActionListener
, DelegatingActionListener
, GroupedActionListener
, LatchedActionListener
, NotifyOnceListener
, PlainActionFuture
, PlainListenableActionFuture
, RestActionListener
, RestActions.NodesResponseRestListener
, RestBuilderListener
, RestResponseListener
, RestStatusToXContentListener
, RestToXContentListener
, SearchExecutionStatsCollector
, ThreadedActionListener
public interface ActionListener<Response>
Modifier and Type | Method | Description |
---|---|---|
void |
onFailure(java.lang.Exception e) |
A failure caused by an exception at some phase of the task.
|
static <Response> void |
onFailure(java.lang.Iterable<ActionListener<Response>> listeners,
java.lang.Exception failure) |
Notifies every given listener with the failure passed to
onFailure(Exception) . |
static <Response> void |
onResponse(java.lang.Iterable<ActionListener<Response>> listeners,
Response response) |
Notifies every given listener with the response passed to
onResponse(Object) . |
void |
onResponse(Response response) |
Handle action response.
|
static <Response> java.util.function.BiConsumer<Response,java.lang.Throwable> |
toBiConsumer(ActionListener<Response> listener) |
Converts a listener to a
BiConsumer for compatibility with the CompletableFuture
api. |
static <Response> ActionListener<Response> |
wrap(java.lang.Runnable runnable) |
Creates a listener that listens for a response (or failure) and executes the
corresponding runnable when the response (or failure) is received.
|
static <Response> ActionListener<Response> |
wrap(CheckedConsumer<Response,? extends java.lang.Exception> onResponse,
java.util.function.Consumer<java.lang.Exception> onFailure) |
Creates a listener that listens for a response (or failure) and executes the
corresponding consumer when the response (or failure) is received.
|
void onResponse(Response response)
void onFailure(java.lang.Exception e)
static <Response> ActionListener<Response> wrap(CheckedConsumer<Response,? extends java.lang.Exception> onResponse, java.util.function.Consumer<java.lang.Exception> onFailure)
Response
- the type of the responseonResponse
- the checked consumer of the response, when the listener receives oneonFailure
- the consumer of the failure, when the listener receives onestatic <Response> ActionListener<Response> wrap(java.lang.Runnable runnable)
Response
- the type of the responserunnable
- the runnable that will be called in event of success or failurestatic <Response> java.util.function.BiConsumer<Response,java.lang.Throwable> toBiConsumer(ActionListener<Response> listener)
BiConsumer
for compatibility with the CompletableFuture
api.Response
- the type of the responselistener
- that will be wrappedstatic <Response> void onResponse(java.lang.Iterable<ActionListener<Response>> listeners, Response response)
onResponse(Object)
. If a listener itself throws an exception
the exception is forwarded to onFailure(Exception)
. If in turn onFailure(Exception)
fails all remaining
listeners will be processed and the caught exception will be re-thrown.static <Response> void onFailure(java.lang.Iterable<ActionListener<Response>> listeners, java.lang.Exception failure)
onFailure(Exception)
. If a listener itself throws an exception
all remaining listeners will be processed and the caught exception will be re-thrown.