Module org.elasticsearch.xcore
Class StoredAsyncTask<Response extends ActionResponse>
java.lang.Object
org.elasticsearch.tasks.Task
org.elasticsearch.tasks.CancellableTask
org.elasticsearch.xpack.core.async.StoredAsyncTask<Response>
public abstract class StoredAsyncTask<Response extends ActionResponse>
extends CancellableTask
implements AsyncTask
-
Nested Class Summary
Nested classes/interfaces inherited from class org.elasticsearch.tasks.CancellableTask
CancellableTask.CancellationListenerNested classes/interfaces inherited from class org.elasticsearch.tasks.Task
Task.Status -
Field Summary
FieldsFields inherited from class org.elasticsearch.tasks.Task
APM_TRACE_CONTEXT, HEADERS_TO_COPY, TRACE_ID, TRACE_PARENT, TRACE_PARENT_HTTP_HEADER, TRACE_START_TIME, TRACE_STATE, X_ELASTIC_PRODUCT_ORIGIN_HTTP_HEADER, X_ELASTIC_PROJECT_ID_HTTP_HEADER, X_OPAQUE_ID_HTTP_HEADER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddCompletionListener(Supplier<ActionListener<Response>> listenerSupplier) voidcancelTask(TaskManager taskManager, Runnable runnable, String reason) Performs necessary checks, cancels the task and calls the runnable upon completionabstract ResponseReturn currently available partial or the final resultsReturns theAsyncExecutionIdof the tasklongReturns all of the request contexts headersvoidThis method is called when the task failed before unregistering the task and storing the resultsvoidonResponse(Response response) This method is called when the task is finished successfully before unregistering the task and storing the resultsvoidremoveCompletionListener(ActionListener<Response> listener) voidsetExpirationTime(long expirationTime) Update the expiration time of the (partial) response.Methods inherited from class org.elasticsearch.tasks.CancellableTask
addListener, ensureNotCancelled, getReasonCancelled, isCancelled, notifyIfCancelled, onCancelled, shouldCancelChildrenOnCancellation, toStringMethods inherited from class org.elasticsearch.tasks.Task
getAction, getDescription, getHeader, getId, getParentTaskId, getProjectId, getSpanId, getStartTime, getStartTimeNanos, getStatus, getType, headers, result, result, taskInfo, taskInfoMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.xpack.core.async.AsyncTask
isCancelled
-
Field Details
-
completionListeners
-
-
Constructor Details
-
StoredAsyncTask
-
-
Method Details
-
getOriginHeaders
Description copied from interface:AsyncTaskReturns all of the request contexts headers- Specified by:
getOriginHeadersin interfaceAsyncTask
-
getExecutionId
Description copied from interface:AsyncTaskReturns theAsyncExecutionIdof the task- Specified by:
getExecutionIdin interfaceAsyncTask
-
setExpirationTime
public void setExpirationTime(long expirationTime) Update the expiration time of the (partial) response.- Specified by:
setExpirationTimein interfaceAsyncTask
-
getExpirationTimeMillis
public long getExpirationTimeMillis() -
addCompletionListener
-
removeCompletionListener
-
onResponse
This method is called when the task is finished successfully before unregistering the task and storing the results -
onFailure
This method is called when the task failed before unregistering the task and storing the results -
getCurrentResult
Return currently available partial or the final results -
cancelTask
Description copied from interface:AsyncTaskPerforms necessary checks, cancels the task and calls the runnable upon completion- Specified by:
cancelTaskin interfaceAsyncTask
-