Record Class TaskInfo

java.lang.Object
java.lang.Record
org.elasticsearch.tasks.TaskInfo
All Implemented Interfaces:
Writeable, ToXContent, ToXContentFragment

public record TaskInfo(TaskId taskId, String type, String node, String action, String description, Task.Status status, long startTime, long runningTimeNanos, boolean cancellable, boolean cancelled, TaskId parentTaskId, Map<String,String> headers) extends Record implements Writeable, ToXContentFragment
Information about a currently running task.

Tasks are used for communication with transport actions. As a result, they can contain callback references as well as mutable state. That makes it impractical to send tasks over transport channels and use in APIs. Instead, immutable and writeable TaskInfo objects are used to represent snapshot information about currently running tasks.

  • Field Details

  • Constructor Details

    • TaskInfo

      public TaskInfo(TaskId taskId, String type, String node, String action, String description, Task.Status status, long startTime, long runningTimeNanos, boolean cancellable, boolean cancelled, TaskId parentTaskId, Map<String,String> headers)
      Creates an instance of a TaskInfo record class.
      Parameters:
      taskId - the value for the taskId record component
      type - the value for the type record component
      node - the value for the node record component
      action - the value for the action record component
      description - the value for the description record component
      status - the value for the status record component
      startTime - the value for the startTime record component
      runningTimeNanos - the value for the runningTimeNanos record component
      cancellable - the value for the cancellable record component
      cancelled - the value for the cancelled record component
      parentTaskId - the value for the parentTaskId record component
      headers - the value for the headers record component
  • Method Details

    • from

      public static TaskInfo from(StreamInput in) throws IOException
      Read from a stream.
      Throws:
      IOException
    • writeTo

      public void writeTo(StreamOutput out) throws IOException
      Description copied from interface: Writeable
      Write this into the StreamOutput.
      Specified by:
      writeTo in interface Writeable
      Throws:
      IOException
    • id

      public long id()
    • toXContent

      public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException
      Specified by:
      toXContent in interface ToXContent
      Throws:
      IOException
    • fromXContent

      public static TaskInfo fromXContent(XContentParser parser)
    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • taskId

      public TaskId taskId()
      Returns the value of the taskId record component.
      Returns:
      the value of the taskId record component
    • type

      public String type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • node

      public String node()
      Returns the value of the node record component.
      Returns:
      the value of the node record component
    • action

      public String action()
      Returns the value of the action record component.
      Returns:
      the value of the action record component
    • description

      public String description()
      Returns the value of the description record component.
      Returns:
      the value of the description record component
    • status

      public Task.Status status()
      Returns the value of the status record component.
      Returns:
      the value of the status record component
    • startTime

      public long startTime()
      Returns the value of the startTime record component.
      Returns:
      the value of the startTime record component
    • runningTimeNanos

      public long runningTimeNanos()
      Returns the value of the runningTimeNanos record component.
      Returns:
      the value of the runningTimeNanos record component
    • cancellable

      public boolean cancellable()
      Returns the value of the cancellable record component.
      Returns:
      the value of the cancellable record component
    • cancelled

      public boolean cancelled()
      Returns the value of the cancelled record component.
      Returns:
      the value of the cancelled record component
    • parentTaskId

      public TaskId parentTaskId()
      Returns the value of the parentTaskId record component.
      Returns:
      the value of the parentTaskId record component
    • headers

      public Map<String,String> headers()
      Returns the value of the headers record component.
      Returns:
      the value of the headers record component