Interface SchedulerClient

    • Method Detail

      • scheduleIfNotExists

        <T> boolean scheduleIfNotExists​(TaskInstance<T> taskInstance,
                                        Instant executionTime)
        Schedule a new execution if task instance does not already exists.
        Parameters:
        taskInstance - Task-instance, optionally with data
        executionTime - Instant it should run
        Returns:
        true if scheduled successfully
        See Also:
        Instant, TaskInstance
      • scheduleIfNotExists

        <T> boolean scheduleIfNotExists​(SchedulableInstance<T> schedulableInstance)
        Schedule a new execution if task instance does not already exists.
        Parameters:
        schedulableInstance - Task-instance and time it should run
        Returns:
        true if scheduled successfully
        See Also:
        SchedulableInstance
      • scheduleBatch

        void scheduleBatch​(List<TaskInstance<?>> taskInstances,
                           Instant executionTime)
        Schedule a batch of executions. If any of the executions already exists, the scheduling will fail and an exception will be thrown.
        Parameters:
        taskInstances - Task-instance to schedule, optionally with data
        executionTime - Instant it should run
        See Also:
        Instant, TaskInstance
      • scheduleBatch

        void scheduleBatch​(List<SchedulableInstance<?>> schedulableInstances)
        Schedule a batch of executions. If any of the executions already exists, the scheduling will fail and an exception will be thrown.
        Parameters:
        schedulableInstances - Task-instances with individual execution-times
        See Also:
        SchedulableInstance
      • scheduleBatch

        default void scheduleBatch​(Stream<TaskInstance<?>> taskInstances,
                                   Instant executionTime)
        Schedule a batch of executions. If any of the executions already exists, the scheduling will fail and an exception will be thrown.
        Parameters:
        taskInstances - Task-instances to schedule, optionally with data
        executionTime - Instant it should run
        See Also:
        Instant, TaskInstance
      • scheduleBatch

        default void scheduleBatch​(Stream<SchedulableInstance<?>> schedulableInstances)
        Schedule a batch of executions. If any of the executions already exists, the scheduling will fail and an exception will be thrown.
        Parameters:
        schedulableInstances - Task-instances with individual execution-times
        See Also:
        SchedulableInstance
      • reschedule

        boolean reschedule​(TaskInstanceId taskInstanceId,
                           Instant newExecutionTime)
        Update an existing execution to a new execution-time. If the execution does not exist or if it is currently running, an exception is thrown.
        Parameters:
        taskInstanceId - Task-instance to reschedule, expected to exist
        newExecutionTime - the new execution-time
        Returns:
        true if rescheduled successfully
        See Also:
        Instant, TaskInstanceId
      • reschedule

        <T> boolean reschedule​(TaskInstanceId taskInstanceId,
                               Instant newExecutionTime,
                               T newData)
        Update an existing execution with a new execution-time and new task-data. If the execution does not exist or if it is currently running, an exception is thrown.
        Parameters:
        taskInstanceId -
        newExecutionTime - the new execution-time
        newData - the new task-data
        Returns:
        true if rescheduled successfully
        See Also:
        Instant, TaskInstanceId
      • reschedule

        <T> boolean reschedule​(SchedulableInstance<T> schedulableInstance)
        Update an existing execution with a new execution-time and new task-data. If the execution does not exist or if it is currently running, an exception is thrown.
        Parameters:
        schedulableInstance - the updated instance
        Returns:
        true if rescheduled successfully
      • cancel

        void cancel​(TaskInstanceId taskInstanceId)
        Removes/Cancels an execution.
        Parameters:
        taskInstanceId -
        See Also:
        TaskInstanceId
      • fetchScheduledExecutions

        void fetchScheduledExecutions​(Consumer<ScheduledExecution<Object>> consumer)
        Gets all scheduled executions and supplies them to the provided Consumer. A Consumer is used to avoid forcing the SchedulerClient to load all executions in memory. Currently running executions are not returned.
        Parameters:
        consumer - Consumer for the executions
      • fetchScheduledExecutionsForTask

        <T> void fetchScheduledExecutionsForTask​(String taskName,
                                                 Class<T> dataClass,
                                                 Consumer<ScheduledExecution<T>> consumer)
        Gets all scheduled executions for a task and supplies them to the provided Consumer. A Consumer is used to avoid forcing the SchedulerClient to load all executions in memory. Currently running executions are not returned.
        Parameters:
        taskName - the name of the task to get scheduled-executions for
        dataClass - the task data-class the data will be serialized and cast to
        consumer - Consumer for the executions