Module org.elasticsearch.server
Package org.elasticsearch.persistent
Class PersistentTasks.Builder<T extends PersistentTasks.Builder<T>>
java.lang.Object
org.elasticsearch.persistent.PersistentTasks.Builder<T>
- Direct Known Subclasses:
ClusterPersistentTasksCustomMetadata.Builder,PersistentTasksCustomMetadata.Builder
- Enclosing interface:
PersistentTasks
public abstract static class PersistentTasks.Builder<T extends PersistentTasks.Builder<T>>
extends Object
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBuilder()protectedBuilder(PersistentTasks tasksInProgress) -
Method Summary
Modifier and TypeMethodDescription<Params extends PersistentTaskParams>
TaddTask(String taskId, String taskName, Params params, PersistentTasksCustomMetadata.Assignment assignment) Adds a new task to the builderabstract PersistentTasksbuild()final ClusterStatebuildAndUpdate(ClusterState currentState, ProjectId projectId) protected abstract ClusterStatedoBuildAndUpdate(ClusterState currentState, ProjectId projectId) longbooleanChecks if the task is currently present in the listbooleanChecks if the task is currently present in the list and has the right allocation idbooleanReturns true if any the task list was changed since the builder was createdreassignTask(String taskId, PersistentTasksCustomMetadata.Assignment assignment) Reassigns the task to another noderemoveTask(String taskId) Removes the taskprotected TsetLastAllocationId(long currentId) protected TsetLastAllocationId(ClusterState clusterState) protected <Params extends PersistentTaskParams>
TsetTasks(List<PersistentTasks.TaskBuilder<Params>> tasks) updateTaskState(String taskId, PersistentTaskState taskState) Updates the task state
-
Constructor Details
-
Builder
protected Builder() -
Builder
-
-
Method Details
-
getLastAllocationId
public long getLastAllocationId() -
setLastAllocationId
-
setLastAllocationId
-
setTasks
protected <Params extends PersistentTaskParams> T setTasks(List<PersistentTasks.TaskBuilder<Params>> tasks) -
addTask
public <Params extends PersistentTaskParams> T addTask(String taskId, String taskName, Params params, PersistentTasksCustomMetadata.Assignment assignment) Adds a new task to the builderAfter the task is added its id can be found by calling {
getLastAllocationId()} method. -
reassignTask
Reassigns the task to another node -
updateTaskState
Updates the task state -
removeTask
Removes the task -
hasTask
Checks if the task is currently present in the list -
hasTask
Checks if the task is currently present in the list and has the right allocation id -
isChanged
public boolean isChanged()Returns true if any the task list was changed since the builder was created -
build
-
buildAndUpdate
-
doBuildAndUpdate
-