Class CancellableTask

java.lang.Object
org.elasticsearch.tasks.Task
org.elasticsearch.tasks.CancellableTask
Direct Known Subclasses:
AllocatedPersistentTask, BulkByScrollTask, SearchShardTask, SearchTask

public class CancellableTask
extends Task
A task that can be cancelled
  • Constructor Details

    • CancellableTask

      public CancellableTask​(long id, java.lang.String type, java.lang.String action, java.lang.String description, TaskId parentTaskId, java.util.Map<java.lang.String,​java.lang.String> headers)
  • 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 returning false saves a bit of computation in the task manager.
    • isCancelled

      public boolean isCancelled()
    • getReasonCancelled

      @Nullable public final java.lang.String 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.