public class ExecutionTask extends java.lang.Object implements java.lang.Comparable<ExecutionTask>
PENDING ---> IN_PROGRESS ------------> COMPLETED
|
|
|----> ABORTING ----> ABORTED
| |
| v
|-------------------> DEAD
A newly created task is in PENDING state.
A PENDING task becomes IN_PROGRESS when it is drained from the ExecutionTaskPlanner
An IN_PROGRESS task becomes COMPLETED if the execution is done without error.
An IN_PROGRESS task becomes ABORTING if an error is encountered and the rollback is possible.
An IN_PROGRESS task becomes DEAD if an error is encountered and the rollback is not possible.
An ABORTING task becomes ABORTED if the rollback of the original task is successfully done.
An ABORTING task becomes DEAD if the rollback of the original task encountered an error.
Modifier and Type | Class and Description |
---|---|
static class |
ExecutionTask.State |
static class |
ExecutionTask.TaskType |
Constructor and Description |
---|
ExecutionTask(long executionId,
ExecutionProposal proposal,
ExecutionTask.TaskType type) |
ExecutionTask(long executionId,
ExecutionProposal proposal,
java.lang.Integer brokerId,
ExecutionTask.TaskType type)
Construct an execution task.
|
Modifier and Type | Method and Description |
---|---|
void |
abort()
Abort the task.
|
void |
aborted(long now)
Change the task state to aborted.
|
int |
brokerId() |
boolean |
canTransferToState(ExecutionTask.State targetState)
Check if the state transfer is possible.
|
int |
compareTo(ExecutionTask o) |
void |
completed(long now)
Change the task state to completed.
|
long |
endTime() |
boolean |
equals(java.lang.Object o) |
long |
executionId() |
java.util.Map<java.lang.String,java.lang.Object> |
getJsonStructure()
Return an object that can be further used
to encode into JSON
|
int |
hashCode() |
void |
inProgress(long now)
Mark task in progress.
|
void |
kill(long now)
Kill the task.
|
ExecutionProposal |
proposal() |
long |
startTime() |
ExecutionTask.State |
state() |
java.lang.String |
toString() |
ExecutionTask.TaskType |
type() |
java.util.Set<ExecutionTask.State> |
validTargetState() |
public ExecutionTask(long executionId, ExecutionProposal proposal, java.lang.Integer brokerId, ExecutionTask.TaskType type)
executionId
- The execution id of the proposal so we can keep track of the task when execute it.proposal
- The corresponding balancing proposal of this task.brokerId
- The broker to operate on if the task is of type ExecutionTask.TaskType.INTRA_BROKER_REPLICA_ACTION
.type
- the ExecutionTask.TaskType
of this task.public ExecutionTask(long executionId, ExecutionProposal proposal, ExecutionTask.TaskType type)
public boolean canTransferToState(ExecutionTask.State targetState)
targetState
- the state to transfer to.public java.util.Set<ExecutionTask.State> validTargetState()
public long executionId()
public ExecutionProposal proposal()
public ExecutionTask.TaskType type()
public ExecutionTask.State state()
public long startTime()
public long endTime()
public int brokerId()
public void inProgress(long now)
public void kill(long now)
public void abort()
public void aborted(long now)
public void completed(long now)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.util.Map<java.lang.String,java.lang.Object> getJsonStructure()
public java.lang.String toString()
toString
in class java.lang.Object
public int compareTo(ExecutionTask o)
compareTo
in interface java.lang.Comparable<ExecutionTask>