Package org.elasticsearch.tasks
Class CancellableTask
java.lang.Object
org.elasticsearch.tasks.Task
org.elasticsearch.tasks.CancellableTask
- Direct Known Subclasses:
AllocatedPersistentTask
,BulkByScrollTask
,SearchShardTask
,SearchTask
A task that can be cancelled
-
Nested Class Summary
Nested classes/interfaces inherited from class org.elasticsearch.tasks.Task
Task.Status
-
Field Summary
Fields inherited from class org.elasticsearch.tasks.Task
X_OPAQUE_ID
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionThe reason the task was cancelled or null if it hasn't been cancelled.boolean
protected void
Called after the task is cancelled so that it can take any actions that it has to take.boolean
Returns whether this task's children need to be cancelled too.Methods inherited from class org.elasticsearch.tasks.Task
getAction, getDescription, getHeader, getId, getParentTaskId, getStartTime, getStartTimeNanos, getStatus, getType, headers, result, result, taskInfo, taskInfo
-
Constructor Details
-
CancellableTask
-
-
Method Details
-
shouldCancelChildrenOnCancellation
public boolean shouldCancelChildrenOnCancellation()Returns whether this task's children need to be cancelled too.true
is a reasonable response even for tasks that have no children, since child tasks might be added in future and it'd be easy to forget to update this, but returningfalse
saves a bit of computation in the task manager. -
isCancelled
public boolean isCancelled() -
getReasonCancelled
The reason the task was cancelled or null if it hasn't been cancelled. -
onCancelled
protected void onCancelled()Called after the task is cancelled so that it can take any actions that it has to take.
-