Class TaskResult

org.elasticsearch.tasks.TaskResult
All Implemented Interfaces:
Writeable, org.elasticsearch.common.xcontent.ToXContent, org.elasticsearch.common.xcontent.ToXContentObject

public final class TaskResult extends implements Writeable, org.elasticsearch.common.xcontent.ToXContentObject
Information about a running task or a task that stored its result. Running tasks just have a getTask() while tasks with stored result will have either a getError() or getResponse().
  • Nested Class Summary

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

    org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.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 org.elasticsearch.common.xcontent.InstantiatingObjectParser<>
     

    Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent

    EMPTY_PARAMS
  • Constructor Summary

    Constructors
    Constructor
    Description
    TaskResult​(boolean completed, TaskInfo task)
    Construct a TaskResult for a task for which we don't have a result or error.
    TaskResult​(boolean completed, TaskInfo task, BytesReference error, BytesReference result)
     
    Read from a stream.
    TaskResult​(TaskInfo task,  error)
    Construct a TaskResult for a task that completed with an error.
    TaskResult​(TaskInfo task, org.elasticsearch.common.xcontent.ToXContent response)
    Construct a TaskResult for a task that completed successfully.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     obj)
     
    Get the error that finished this task.
    <,​>
    Convert getError() from XContent to a Map for easy processing.
    Get the response that this task finished with.
    <,​>
    Convert getResponse() from XContent to a Map for easy processing.
    Get the task that this wraps.
    int
     
    org.elasticsearch.common.xcontent.XContentBuilder
    innerToXContent​(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)
     
    boolean
     
     
    org.elasticsearch.common.xcontent.XContentBuilder
    toXContent​(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)
     
    void
    Write this into the StreamOutput.

    Methods inherited from class java.lang.

    , , , , , , ,

    Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentObject

    isFragment
  • Field Details

    • PARSER

      public static final org.elasticsearch.common.xcontent.InstantiatingObjectParser<> PARSER
  • Constructor Details

    • TaskResult

      public TaskResult(boolean completed, TaskInfo task)
      Construct a TaskResult for a task for which we don't have a result or error. That usually means that the task is incomplete, but it could also mean that we waited for the task to complete but it didn't save any error information.
    • TaskResult

      public TaskResult(TaskInfo task,  error) throws
      Construct a TaskResult for a task that completed with an error.
      Throws:
    • TaskResult

      public TaskResult(TaskInfo task, org.elasticsearch.common.xcontent.ToXContent response) throws
      Construct a TaskResult for a task that completed successfully.
      Throws:
    • TaskResult

      public TaskResult(boolean completed, TaskInfo task, @Nullable BytesReference error, @Nullable BytesReference result)
    • TaskResult

      public TaskResult(StreamInput in) throws
      Read from a stream.
      Throws:
  • Method Details

    • writeTo

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

      public TaskInfo getTask()
      Get the task that this wraps.
    • getError

      public BytesReference getError()
      Get the error that finished this task. Will return null if the task didn't finish with an error, it hasn't yet finished, or didn't store its result.
    • getErrorAsMap

      public <,​> getErrorAsMap()
      Convert getError() from XContent to a Map for easy processing. Will return an empty map if the task didn't finish with an error, hasn't yet finished, or didn't store its result.
    • getResponse

      public BytesReference getResponse()
      Get the response that this task finished with. Will return null if the task was finished by an error, it hasn't yet finished, or didn't store its result.
    • getResponseAsMap

      public <,​> getResponseAsMap()
      Convert getResponse() from XContent to a Map for easy processing. Will return an empty map if the task was finished with an error, hasn't yet finished, or didn't store its result.
    • isCompleted

      public boolean isCompleted()
    • toXContent

      public org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws
      Specified by:
      toXContent in interface org.elasticsearch.common.xcontent.ToXContent
      Throws:
    • innerToXContent

      public org.elasticsearch.common.xcontent.XContentBuilder innerToXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws
      Throws:
    • toString

      public  toString()
      Overrides:
       in class 
    • equals

      public boolean equals( obj)
      Overrides:
       in class 
    • hashCode

      public int hashCode()
      Overrides:
       in class