Package org.elasticsearch.tasks
Class TaskResult
java.lang.Object
org.elasticsearch.tasks.TaskResult
- All Implemented Interfaces:
Writeable
,ToXContent
,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.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Field Summary
Fields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY_PARAMS
-
Constructor Summary
ConstructorDescriptionTaskResult
(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, Exception error) Construct a TaskResult for a task that completed with an error.TaskResult
(TaskInfo task, ToXContent response) Construct a TaskResult for a task that completed successfully. -
Method Summary
Modifier and TypeMethodDescriptionboolean
getError()
Get the error that finished this task.ConvertgetError()
from XContent to a Map for easy processing.Get the response that this task finished with.ConvertgetResponse()
from XContent to a Map for easy processing.getTask()
Get the task that this wraps.int
hashCode()
innerToXContent
(XContentBuilder builder, ToXContent.Params params) boolean
toString()
toXContent
(XContentBuilder builder, ToXContent.Params params) void
writeTo
(StreamOutput out) 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.ToXContentObject
isFragment
-
Field Details
-
PARSER
-
-
Constructor Details
-
TaskResult
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
Construct a TaskResult for a task that completed with an error.- Throws:
IOException
-
TaskResult
Construct a TaskResult for a task that completed successfully.- Throws:
IOException
-
TaskResult
public TaskResult(boolean completed, TaskInfo task, @Nullable BytesReference error, @Nullable BytesReference result) -
TaskResult
Read from a stream.- Throws:
IOException
-
-
Method Details
-
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput.- Specified by:
writeTo
in interfaceWriteable
- Throws:
IOException
-
getTask
Get the task that this wraps. -
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
ConvertgetError()
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
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
ConvertgetResponse()
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 XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException - Specified by:
toXContent
in interfaceToXContent
- Throws:
IOException
-
innerToXContent
public XContentBuilder innerToXContent(XContentBuilder builder, ToXContent.Params params) throws IOException - Throws:
IOException
-
toString
-
equals
-
hashCode
public int hashCode()
-