java.lang.Object
org.elasticsearch.persistent.PersistentTasksService
This service is used by persistent tasks and allocated persistent tasks to communicate changes
to the master node so that the master can update the cluster state and can track of the states
of the persistent tasks.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPersistentTasksService
(ClusterService clusterService, ThreadPool threadPool, Client client) -
Method Summary
Modifier and TypeMethodDescriptionvoid
sendClusterCompletionRequest
(String taskId, long taskAllocationId, Exception taskFailure, String localAbortReason, TimeValue timeout, ActionListener<PersistentTasksCustomMetadata.PersistentTask<?>> listener) Notifies the master node about the completion of a persistent task.void
sendClusterRemoveRequest
(String taskId, TimeValue timeout, ActionListener<PersistentTasksCustomMetadata.PersistentTask<?>> listener) Notifies the master node to remove a persistent task from the cluster state.<Params extends PersistentTaskParams>
voidsendClusterStartRequest
(String taskId, String taskName, Params taskParams, TimeValue timeout, ActionListener<PersistentTasksCustomMetadata.PersistentTask<Params>> listener) Notifies the master node to create new cluster persistent task and to assign it to a node.void
sendCompletionRequest
(String taskId, long taskAllocationId, Exception taskFailure, String localAbortReason, TimeValue timeout, ActionListener<PersistentTasksCustomMetadata.PersistentTask<?>> listener) Deprecated, for removal: This API element is subject to removal in a future version.void
sendProjectCompletionRequest
(ProjectId projectId, String taskId, long taskAllocationId, Exception taskFailure, String localAbortReason, TimeValue timeout, ActionListener<PersistentTasksCustomMetadata.PersistentTask<?>> listener) Notifies the master node about the completion of a project level persistent task.void
sendProjectRemoveRequest
(ProjectId projectId, String taskId, TimeValue timeout, ActionListener<PersistentTasksCustomMetadata.PersistentTask<?>> listener) Notifies the master node to remove a project level persistent task from the cluster state.<Params extends PersistentTaskParams>
voidsendProjectStartRequest
(ProjectId projectId, String taskId, String taskName, Params taskParams, TimeValue timeout, ActionListener<PersistentTasksCustomMetadata.PersistentTask<Params>> listener) Notifies the master node to create new project level persistent task and to assign it to a node.void
sendRemoveRequest
(String taskId, TimeValue timeout, ActionListener<PersistentTasksCustomMetadata.PersistentTask<?>> listener) Notifies the master node to remove a persistent task from the cluster state.<Params extends PersistentTaskParams>
voidsendStartRequest
(String taskId, String taskName, Params taskParams, TimeValue timeout, ActionListener<PersistentTasksCustomMetadata.PersistentTask<Params>> listener) Deprecated, for removal: This API element is subject to removal in a future version.void
waitForPersistentTaskCondition
(String taskId, Predicate<PersistentTasksCustomMetadata.PersistentTask<?>> predicate, TimeValue timeout, PersistentTasksService.WaitForPersistentTaskListener<?> listener) Deprecated, for removal: This API element is subject to removal in a future version.void
waitForPersistentTaskCondition
(ProjectId projectId, String taskId, Predicate<PersistentTasksCustomMetadata.PersistentTask<?>> predicate, TimeValue timeout, PersistentTasksService.WaitForPersistentTaskListener<?> listener) Waits for a given persistent task to comply with a given predicate, then call back the listener accordingly.void
waitForPersistentTasksCondition
(ProjectId projectId, Predicate<PersistentTasksCustomMetadata> predicate, TimeValue timeout, ActionListener<Boolean> listener) Waits for persistent tasks to comply with a given predicate, then call back the listener accordingly.
-
Field Details
-
PERSISTENT_TASK_ORIGIN
- See Also:
-
-
Constructor Details
-
PersistentTasksService
-
-
Method Details
-
sendStartRequest
@Deprecated(forRemoval=true) public <Params extends PersistentTaskParams> void sendStartRequest(String taskId, String taskName, Params taskParams, TimeValue timeout, ActionListener<PersistentTasksCustomMetadata.PersistentTask<Params>> listener) Deprecated, for removal: This API element is subject to removal in a future version.Notifies the master node to create new persistent task and to assign it to a node. Accepts operation timeout as optional parameter -
sendClusterStartRequest
public <Params extends PersistentTaskParams> void sendClusterStartRequest(String taskId, String taskName, Params taskParams, TimeValue timeout, ActionListener<PersistentTasksCustomMetadata.PersistentTask<Params>> listener) Notifies the master node to create new cluster persistent task and to assign it to a node. Accepts operation timeout as optional parameter -
sendProjectStartRequest
public <Params extends PersistentTaskParams> void sendProjectStartRequest(ProjectId projectId, String taskId, String taskName, Params taskParams, TimeValue timeout, ActionListener<PersistentTasksCustomMetadata.PersistentTask<Params>> listener) Notifies the master node to create new project level persistent task and to assign it to a node. Accepts operation timeout as optional parameter -
sendCompletionRequest
@Deprecated(forRemoval=true) public void sendCompletionRequest(String taskId, long taskAllocationId, @Nullable Exception taskFailure, @Nullable String localAbortReason, @Nullable TimeValue timeout, ActionListener<PersistentTasksCustomMetadata.PersistentTask<?>> listener) Deprecated, for removal: This API element is subject to removal in a future version.Notifies the master node about the completion of a persistent task.At most one of
failure
andlocalAbortReason
may be provided. When bothfailure
andlocalAbortReason
arenull
, the persistent task is considered as successfully completed. Accepts operation timeout as optional parameter -
sendClusterCompletionRequest
public void sendClusterCompletionRequest(String taskId, long taskAllocationId, @Nullable Exception taskFailure, @Nullable String localAbortReason, @Nullable TimeValue timeout, ActionListener<PersistentTasksCustomMetadata.PersistentTask<?>> listener) Notifies the master node about the completion of a persistent task.At most one of
failure
andlocalAbortReason
may be provided. When bothfailure
andlocalAbortReason
arenull
, the persistent task is considered as successfully completed. Accepts operation timeout as optional parameter -
sendProjectCompletionRequest
public void sendProjectCompletionRequest(ProjectId projectId, String taskId, long taskAllocationId, @Nullable Exception taskFailure, @Nullable String localAbortReason, @Nullable TimeValue timeout, ActionListener<PersistentTasksCustomMetadata.PersistentTask<?>> listener) Notifies the master node about the completion of a project level persistent task.At most one of
failure
andlocalAbortReason
may be provided. When bothfailure
andlocalAbortReason
arenull
, the persistent task is considered as successfully completed. Accepts operation timeout as optional parameter -
sendRemoveRequest
public void sendRemoveRequest(String taskId, TimeValue timeout, ActionListener<PersistentTasksCustomMetadata.PersistentTask<?>> listener) Notifies the master node to remove a persistent task from the cluster state. Accepts operation timeout as optional parameter -
sendClusterRemoveRequest
public void sendClusterRemoveRequest(String taskId, TimeValue timeout, ActionListener<PersistentTasksCustomMetadata.PersistentTask<?>> listener) Notifies the master node to remove a persistent task from the cluster state. Accepts operation timeout as optional parameter -
sendProjectRemoveRequest
public void sendProjectRemoveRequest(ProjectId projectId, String taskId, TimeValue timeout, ActionListener<PersistentTasksCustomMetadata.PersistentTask<?>> listener) Notifies the master node to remove a project level persistent task from the cluster state. Accepts operation timeout as optional parameter -
waitForPersistentTaskCondition
@Deprecated(forRemoval=true) public void waitForPersistentTaskCondition(String taskId, Predicate<PersistentTasksCustomMetadata.PersistentTask<?>> predicate, @Nullable TimeValue timeout, PersistentTasksService.WaitForPersistentTaskListener<?> listener) Deprecated, for removal: This API element is subject to removal in a future version.Waits for a given persistent task to comply with a given predicate, then call back the listener accordingly.- Parameters:
taskId
- the persistent task idpredicate
- the persistent task predicate to evaluatetimeout
- a timeout for waitinglistener
- the callback listener
-
waitForPersistentTaskCondition
public void waitForPersistentTaskCondition(ProjectId projectId, String taskId, Predicate<PersistentTasksCustomMetadata.PersistentTask<?>> predicate, @Nullable TimeValue timeout, PersistentTasksService.WaitForPersistentTaskListener<?> listener) Waits for a given persistent task to comply with a given predicate, then call back the listener accordingly.- Parameters:
projectId
- the project IDtaskId
- the persistent task idpredicate
- the persistent task predicate to evaluate, must be able to handlenull
input which means either the project does not exist or persistent tasks for the project do not existtimeout
- a timeout for waitinglistener
- the callback listener
-
waitForPersistentTasksCondition
public void waitForPersistentTasksCondition(ProjectId projectId, Predicate<PersistentTasksCustomMetadata> predicate, @Nullable TimeValue timeout, ActionListener<Boolean> listener) Waits for persistent tasks to comply with a given predicate, then call back the listener accordingly.- Parameters:
projectId
- the project that the persistent tasks are associated withpredicate
- the predicate to evaluate, must be able to handlenull
input which means either the project does not exist or persistent tasks for the project do not existtimeout
- a timeout for waitinglistener
- the callback listener
-