Class TaskResult

    • Constructor Detail

      • 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,
                          java.lang.Exception error)
                   throws java.io.IOException
        Construct a TaskResult for a task that completed with an error.
        Throws:
        java.io.IOException
      • TaskResult

        public TaskResult​(TaskInfo task,
                          ToXContent response)
                   throws java.io.IOException
        Construct a TaskResult for a task that completed successfully.
        Throws:
        java.io.IOException
      • TaskResult

        public TaskResult​(StreamInput in)
                   throws java.io.IOException
        Read from a stream.
        Throws:
        java.io.IOException
    • Method Detail

      • 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 java.util.Map<java.lang.String,​java.lang.Object> 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 java.util.Map<java.lang.String,​java.lang.Object> 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()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object