Class AllocatedPersistentTask

java.lang.Object
org.elasticsearch.tasks.Task
org.elasticsearch.tasks.CancellableTask
org.elasticsearch.persistent.AllocatedPersistentTask

public class AllocatedPersistentTask
extends CancellableTask
Represents a executor node operation that corresponds to a persistent task
  • Constructor Details

    • AllocatedPersistentTask

      public AllocatedPersistentTask​(long id, java.lang.String type, java.lang.String action, java.lang.String description, TaskId parentTask, java.util.Map<java.lang.String,​java.lang.String> headers)
  • Method Details

    • getStatus

      public Task.Status getStatus()
      Description copied from class: Task
      Build a status for this task or null if this task doesn't have status. Since most tasks don't have status this defaults to returning null. While this can never perform IO it might be a costly operation, requiring collating lists of results, etc. So only use it if you need the value.
      Overrides:
      getStatus in class Task
    • updatePersistentTaskState

      public void updatePersistentTaskState​(PersistentTaskState state, ActionListener<PersistentTasksCustomMetadata.PersistentTask<?>> listener)
      Updates the persistent state for the corresponding persistent task.

      This doesn't affect the status of this allocated task.

    • getPersistentTaskId

      public java.lang.String getPersistentTaskId()
    • init

      protected void init​(PersistentTasksService persistentTasksService, TaskManager taskManager, java.lang.String persistentTaskId, long allocationId)
    • getFailure

      public java.lang.Exception getFailure()
    • getAllocationId

      public long getAllocationId()
    • waitForPersistentTask

      public void waitForPersistentTask​(java.util.function.Predicate<PersistentTasksCustomMetadata.PersistentTask<?>> predicate, @Nullable org.elasticsearch.common.unit.TimeValue timeout, PersistentTasksService.WaitForPersistentTaskListener<?> listener)
      Waits for a given persistent task to comply with a given predicate, then call back the listener accordingly.
      Parameters:
      predicate - the persistent task predicate to evaluate
      timeout - a timeout for waiting
      listener - the callback listener
    • isCompleted

      protected final boolean isCompleted()
    • markAsCompleted

      public void markAsCompleted()
    • markAsFailed

      public void markAsFailed​(java.lang.Exception e)