Class PersistentTasksService


  • public class PersistentTasksService
    extends java.lang.Object
    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.
    • Method Detail

      • sendCompletionRequest

        public void sendCompletionRequest​(java.lang.String taskId,
                                          long taskAllocationId,
                                          @Nullable
                                          java.lang.Exception taskFailure,
                                          ActionListener<PersistentTasksCustomMetaData.PersistentTask<?>> listener)
        Notifies the master node about the completion of a persistent task.

        When failure is null, the persistent task is considered as successfully completed.

      • waitForPersistentTasksCondition

        public void waitForPersistentTasksCondition​(java.util.function.Predicate<PersistentTasksCustomMetaData> predicate,
                                                    @Nullable
                                                    TimeValue timeout,
                                                    ActionListener<java.lang.Boolean> listener)
        Waits for persistent tasks to comply with a given predicate, then call back the listener accordingly.
        Parameters:
        predicate - the predicate to evaluate
        timeout - a timeout for waiting
        listener - the callback listener