Package org.elasticsearch.tasks
Class TaskInfo
- java.lang.Object
-
- org.elasticsearch.tasks.TaskInfo
-
- All Implemented Interfaces:
Writeable,ToXContent,ToXContentFragment
public final class TaskInfo extends Object 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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.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 Modifier and Type Field Description static ConstructingObjectParser<TaskInfo,Void>PARSER-
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
-
Constructor Summary
Constructors Constructor Description TaskInfo(StreamInput in)Read from a stream.TaskInfo(TaskId taskId, String type, String action, String description, Task.Status status, long startTime, long runningTimeNanos, boolean cancellable, TaskId parentTaskId, Map<String,String> headers)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)static TaskInfofromXContent(XContentParser parser)StringgetAction()StringgetDescription()Map<String,String>getHeaders()Returns the task headerslonggetId()TaskIdgetParentTaskId()Returns the parent task idlonggetRunningTimeNanos()Returns the task running timelonggetStartTime()Returns the task start timeTask.StatusgetStatus()The status of the running task.TaskIdgetTaskId()StringgetType()inthashCode()booleanisCancellable()Returns true if the task supports cancellationStringtoString()XContentBuildertoXContent(XContentBuilder builder, ToXContent.Params params)voidwriteTo(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.common.xcontent.ToXContentFragment
isFragment
-
-
-
-
Field Detail
-
PARSER
public static final ConstructingObjectParser<TaskInfo,Void> PARSER
-
-
Constructor Detail
-
TaskInfo
public TaskInfo(TaskId taskId, String type, String action, String description, Task.Status status, long startTime, long runningTimeNanos, boolean cancellable, TaskId parentTaskId, Map<String,String> headers)
-
TaskInfo
public TaskInfo(StreamInput in) throws IOException
Read from a stream.- Throws:
IOException
-
-
Method Detail
-
writeTo
public void writeTo(StreamOutput out) throws IOException
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
getTaskId
public TaskId getTaskId()
-
getId
public long getId()
-
getType
public String getType()
-
getAction
public String getAction()
-
getDescription
public String getDescription()
-
getStatus
public Task.Status getStatus()
The status of the running task. Only available if TaskInfos were build with the detailed flag.
-
getStartTime
public long getStartTime()
Returns the task start time
-
getRunningTimeNanos
public long getRunningTimeNanos()
Returns the task running time
-
isCancellable
public boolean isCancellable()
Returns true if the task supports cancellation
-
getParentTaskId
public TaskId getParentTaskId()
Returns the parent task id
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException
- Specified by:
toXContentin interfaceToXContent- Throws:
IOException
-
fromXContent
public static TaskInfo fromXContent(XContentParser parser)
-
-