Package org.elasticsearch.tasks
Class Task
java.lang.Object
org.elasticsearch.tasks.Task
- Direct Known Subclasses:
CancellableTask
,PrimaryReplicaSyncer.ResyncTask
,ReplicationTask
Current task information
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Report of the internal status of a task. -
Field Summary
Modifier and TypeFieldDescriptionstatic String
The request header to mark tasks with specific ids -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns task actionGenerates task descriptionReturns stored task header associated with the tasklong
getId()
Returns task idReturns id of the parent task or NO_PARENT_ID if the task doesn't have any parent taskslong
Returns the task's start time as a wall clock time since epoch (System.currentTimeMillis()
style).long
Returns the task's start time in nanoseconds (System.nanoTime()
style).Build a status for this task or null if this task doesn't have status.getType()
Returns task channel type (netty, transport, direct)headers()
result(DiscoveryNode node, Exception error)
result(DiscoveryNode node, ActionResponse response)
Build a version of the task status you can throw over the wire and back to the user.protected TaskInfo
taskInfo(String localNodeId, String description, Task.Status status)
Build a properTaskInfo
for this task.
-
Field Details
-
X_OPAQUE_ID
The request header to mark tasks with specific ids- See Also:
- Constant Field Values
-
-
Constructor Details
-
Task
-
Task
-
-
Method Details
-
taskInfo
Build a version of the task status you can throw over the wire and back to the user.- Parameters:
localNodeId
- the id of the node this task is running ondetailed
- should the information include detailed, potentially slow to generate data?
-
taskInfo
Build a properTaskInfo
for this task. -
getId
public long getId()Returns task id -
getType
Returns task channel type (netty, transport, direct) -
getAction
Returns task action -
getDescription
Generates task description -
getStartTime
public long getStartTime()Returns the task's start time as a wall clock time since epoch (System.currentTimeMillis()
style). -
getStartTimeNanos
public long getStartTimeNanos()Returns the task's start time in nanoseconds (System.nanoTime()
style). -
getParentTaskId
Returns id of the parent task or NO_PARENT_ID if the task doesn't have any parent tasks -
getStatus
Build a status for this task or null if this task doesn't have status. Since most tasks don't have status this defaults to returning null. While this can never perform IO it might be a costly operation, requiring collating lists of results, etc. So only use it if you need the value. -
getHeader
Returns stored task header associated with the task -
headers
-
result
- Throws:
IOException
-
result
- Throws:
IOException
-