Record Class TaskInfo

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

public record TaskInfo(TaskId taskId, String type, 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, org.elasticsearch.xcontent.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.

  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent

    org.elasticsearch.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.xcontent.ToXContent.MapParams, org.elasticsearch.xcontent.ToXContent.Params

    Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable

    Writeable.Reader<V>, Writeable.Writer<V>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final org.elasticsearch.xcontent.ConstructingObjectParser<TaskInfo,Void>
     

    Fields inherited from interface org.elasticsearch.xcontent.ToXContent

    EMPTY_PARAMS
  • Constructor Summary

    Constructors
    Constructor
    Description
    TaskInfo(TaskId taskId, String type, 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.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the action record component.
    boolean
    Returns the value of the cancellable record component.
    boolean
    Returns the value of the cancelled record component.
    Returns the value of the description record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    static TaskInfo
    Read from a stream.
    static TaskInfo
    fromXContent(org.elasticsearch.xcontent.XContentParser parser)
     
    final int
    Returns a hash code value for this object.
    Returns the value of the headers record component.
    long
    id()
     
    Returns the value of the parentTaskId record component.
    long
    Returns the value of the runningTimeNanos record component.
    long
    Returns the value of the startTime record component.
    Returns the value of the status record component.
    Returns the value of the taskId record component.
    Returns a string representation of this record class.
    org.elasticsearch.xcontent.XContentBuilder
    toXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params)
     
    Returns the value of the type record component.
    void
    Write this into the StreamOutput.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.elasticsearch.xcontent.ToXContentFragment

    isFragment
  • Field Details

    • PARSER

      public static final org.elasticsearch.xcontent.ConstructingObjectParser<TaskInfo,Void> PARSER
  • Constructor Details

    • TaskInfo

      public TaskInfo(TaskId taskId, String type, 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
      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 org.elasticsearch.xcontent.XContentBuilder toXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) throws IOException
      Specified by:
      toXContent in interface org.elasticsearch.xcontent.ToXContent
      Throws:
      IOException
    • fromXContent

      public static TaskInfo fromXContent(org.elasticsearch.xcontent.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
    • 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