public class Task
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
Task.Status |
Constructor and Description |
---|
Task(long id,
java.lang.String type,
java.lang.String action,
java.lang.String description,
TaskId parentTask) |
Task(long id,
java.lang.String type,
java.lang.String action,
java.lang.String description,
TaskId parentTask,
long startTime,
long startTimeNanos) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAction()
Returns task action
|
java.lang.String |
getDescription()
Generates task description
|
long |
getId()
Returns task id
|
TaskId |
getParentTaskId()
Returns id of the parent task or NO_PARENT_ID if the task doesn't have any parent tasks
|
long |
getStartTime()
Returns the task's start time as a wall clock time since epoch (
System.currentTimeMillis() style). |
Task.Status |
getStatus()
Build a status for this task or null if this task doesn't have status.
|
java.lang.String |
getType()
Returns task channel type (netty, transport, direct)
|
TaskResult |
result(DiscoveryNode node,
ActionResponse response) |
TaskResult |
result(DiscoveryNode node,
java.lang.Exception error) |
TaskInfo |
taskInfo(java.lang.String localNodeId,
boolean detailed)
Build a version of the task status you can throw over the wire and back
to the user.
|
protected TaskInfo |
taskInfo(java.lang.String localNodeId,
java.lang.String description,
Task.Status status)
Build a proper
TaskInfo for this task. |
public Task(long id, java.lang.String type, java.lang.String action, java.lang.String description, TaskId parentTask)
public Task(long id, java.lang.String type, java.lang.String action, java.lang.String description, TaskId parentTask, long startTime, long startTimeNanos)
public final TaskInfo taskInfo(java.lang.String localNodeId, boolean detailed)
localNodeId
- the id of the node this task is running ondetailed
- should the information include detailed, potentially slow to
generate data?protected final TaskInfo taskInfo(java.lang.String localNodeId, java.lang.String description, Task.Status status)
TaskInfo
for this task.public long getId()
public java.lang.String getType()
public java.lang.String getAction()
public java.lang.String getDescription()
public long getStartTime()
System.currentTimeMillis()
style).public TaskId getParentTaskId()
public Task.Status getStatus()
public TaskResult result(DiscoveryNode node, java.lang.Exception error) throws java.io.IOException
java.io.IOException
public TaskResult result(DiscoveryNode node, ActionResponse response) throws java.io.IOException
java.io.IOException