Class Task

org.elasticsearch.tasks.Task
Direct Known Subclasses:
CancellableTask, PrimaryReplicaSyncer.ResyncTask, ReplicationTask

public class Task extends
Current task information
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    Report of the internal status of a task.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static
    The request header to mark tasks with specific ids
  • Constructor Summary

    Constructors
    Constructor
    Description
    Task​(long id,  type,  action,  description, TaskId parentTask, long startTime, long startTimeNanos, <,​> headers)
     
    Task​(long id,  type,  action,  description, TaskId parentTask, <,​> headers)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns task action
    Generates task description
     header)
    Returns stored task header associated with the task
    long
    Returns task id
    Returns id of the parent task or NO_PARENT_ID if the task doesn't have any parent tasks
    long
    Returns the task's start time as a wall clock time since epoch ( style).
    long
    Returns the task's start time in nanoseconds ( style).
    Build a status for this task or null if this task doesn't have status.
    Returns task channel type (netty, transport, direct)
    <,​>
     
    result​(DiscoveryNode node,  error)
     
    result​(DiscoveryNode node, ActionResponse response)
     
     localNodeId, boolean detailed)
    Build a version of the task status you can throw over the wire and back to the user.
    protected TaskInfo
     localNodeId,  description, Task.Status status)
    Build a proper TaskInfo for this task.

    Methods inherited from class java.lang.

    , , , , , , , , , ,
  • Field Details

    • X_OPAQUE_ID

      public static final  X_OPAQUE_ID
      The request header to mark tasks with specific ids
      See Also:
      Constant Field Values
  • Constructor Details

    • Task

      public Task(long id,  type,  action,  description, TaskId parentTask, <,​> headers)
    • Task

      public Task(long id,  type,  action,  description, TaskId parentTask, long startTime, long startTimeNanos, <,​> headers)
  • Method Details

    • taskInfo

      public final  localNodeId, boolean detailed)
      Build a version of the task status you can throw over the wire and back to the user.
      Parameters:
      localNodeId - the id of the node this task is running on
      detailed - should the information include detailed, potentially slow to generate data?
    • taskInfo

      protected final  localNodeId,  description, Task.Status status)
      Build a proper TaskInfo for this task.
    • getId

      public long getId()
      Returns task id
    • getType

      public  getType()
      Returns task channel type (netty, transport, direct)
    • getAction

      public  getAction()
      Returns task action
    • getDescription

      public  getDescription()
      Generates task description
    • getStartTime

      public long getStartTime()
      Returns the task's start time as a wall clock time since epoch ( style).
    • getStartTimeNanos

      public long getStartTimeNanos()
      Returns the task's start time in nanoseconds ( style).
    • getParentTaskId

      public TaskId getParentTaskId()
      Returns id of the parent task or NO_PARENT_ID if the task doesn't have any parent tasks
    • getStatus

      public Task.Status getStatus()
      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.
    • getHeader

      public  getHeader( header)
      Returns stored task header associated with the task
    • headers

      public <,​> headers()
    • result

      public TaskResult result(DiscoveryNode node,  error) throws
      Throws:
    • result

      public TaskResult result(DiscoveryNode node, ActionResponse response) throws
      Throws: