Package com.github.kagkarlsson.scheduler
Interface SchedulerClient
-
- All Known Implementing Classes:
ManualScheduler,Scheduler,SchedulerClient.StandardSchedulerClient
public interface SchedulerClient
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classSchedulerClient.Builderstatic classSchedulerClient.SchedulerClientNamestatic classSchedulerClient.StandardSchedulerClient
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidcancel(TaskInstanceId taskInstanceId)Removes/Cancels an execution.voidfetchScheduledExecutions(ScheduledExecutionsFilter filter, Consumer<ScheduledExecution<Object>> consumer)voidfetchScheduledExecutions(Consumer<ScheduledExecution<Object>> consumer)Gets all scheduled executions and supplies them to the provided Consumer.<T> voidfetchScheduledExecutionsForTask(String taskName, Class<T> dataClass, ScheduledExecutionsFilter filter, Consumer<ScheduledExecution<T>> consumer)<T> voidfetchScheduledExecutionsForTask(String taskName, Class<T> dataClass, Consumer<ScheduledExecution<T>> consumer)Gets all scheduled executions for a task and supplies them to the provided Consumer.Optional<ScheduledExecution<Object>>getScheduledExecution(TaskInstanceId taskInstanceId)Gets the details for a specific scheduled execution.default List<ScheduledExecution<Object>>getScheduledExecutions()default List<ScheduledExecution<Object>>getScheduledExecutions(ScheduledExecutionsFilter filter)default <T> List<ScheduledExecution<Object>>getScheduledExecutionsForTask(String taskName)default <T> List<ScheduledExecution<T>>getScheduledExecutionsForTask(String taskName, Class<T> dataClass)default <T> List<ScheduledExecution<T>>getScheduledExecutionsForTask(String taskName, Class<T> dataClass, ScheduledExecutionsFilter filter)<T> voidreschedule(SchedulableInstance<T> schedulableInstance)Update an existing execution with a new execution-time and new task-data.voidreschedule(TaskInstanceId taskInstanceId, Instant newExecutionTime)Update an existing execution to a new execution-time.<T> voidreschedule(TaskInstanceId taskInstanceId, Instant newExecutionTime, T newData)Update an existing execution with a new execution-time and new task-data.<T> voidschedule(SchedulableInstance<T> schedulableInstance)<T> voidschedule(TaskInstance<T> taskInstance, Instant executionTime)Schedule a new execution.
-
-
-
Method Detail
-
schedule
<T> void schedule(TaskInstance<T> taskInstance, Instant executionTime)
Schedule a new execution.- Parameters:
taskInstance- Task-instance, optionally with dataexecutionTime- Instant it should run- See Also:
Instant,TaskInstance
-
schedule
<T> void schedule(SchedulableInstance<T> schedulableInstance)
-
reschedule
void 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-newExecutionTime- the new execution-time- See Also:
Instant,TaskInstanceId
-
reschedule
<T> void 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-timenewData- the new task-data- See Also:
Instant,TaskInstanceId
-
reschedule
<T> void 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
-
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
-
fetchScheduledExecutions
void fetchScheduledExecutions(ScheduledExecutionsFilter filter, Consumer<ScheduledExecution<Object>> consumer)
-
getScheduledExecutions
default List<ScheduledExecution<Object>> getScheduledExecutions()
- See Also:
fetchScheduledExecutions(Consumer)
-
getScheduledExecutions
default List<ScheduledExecution<Object>> getScheduledExecutions(ScheduledExecutionsFilter filter)
- See Also:
fetchScheduledExecutions(Consumer)
-
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 fordataClass- the task data-class the data will be serialized and cast toconsumer- Consumer for the executions
-
fetchScheduledExecutionsForTask
<T> void fetchScheduledExecutionsForTask(String taskName, Class<T> dataClass, ScheduledExecutionsFilter filter, Consumer<ScheduledExecution<T>> consumer)
-
getScheduledExecutionsForTask
default <T> List<ScheduledExecution<Object>> getScheduledExecutionsForTask(String taskName)
-
getScheduledExecutionsForTask
default <T> List<ScheduledExecution<T>> getScheduledExecutionsForTask(String taskName, Class<T> dataClass)
-
getScheduledExecutionsForTask
default <T> List<ScheduledExecution<T>> getScheduledExecutionsForTask(String taskName, Class<T> dataClass, ScheduledExecutionsFilter filter)
-
getScheduledExecution
Optional<ScheduledExecution<Object>> getScheduledExecution(TaskInstanceId taskInstanceId)
Gets the details for a specific scheduled execution. Currently running executions are also returned.- Parameters:
taskInstanceId-- Returns:
- Optional.empty() if no matching execution found
- See Also:
TaskInstanceId,ScheduledExecution
-
-