TaskScheduler, typically using cron
expressions.
ScheduledTaskRegistrar has a more prominent user-facing role when used in
conjunction with the @EnableAsync annotation and its
SchedulingConfigurer callback interface.
org.springframework.scheduling.annotation.EnableAsync , org.springframework.scheduling.annotation.SchedulingConfigurer
| Modifier and Type | Field and Description |
|---|---|
| public static final String | CRON_DISABLED
A special cron expression value that indicates a disabled trigger: -. |
| private List | |
| private List | |
| private List | |
| private ScheduledExecutorService | |
| private ObservationRegistry | |
| private List | |
| private final Set | |
| private TaskScheduler | |
| private List | |
| private final Map |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | addCronTask(Runnable task, String expression)
Add a |
| public void | |
| public void | addFixedDelayTask(Runnable task, long interval)
Deprecated
since 6.0. as of 6.0, in favor of
addFixedDelayTask(Runnable, Duration)
Add a Runnable task to be triggered with the given fixed delay. |
| public void | addFixedDelayTask(Runnable task, Duration interval)
Add a Runnable task to be triggered with the given fixed delay. |
| public void | |
| public void | addFixedRateTask(Runnable task, long interval)
Deprecated
since 6.0. as of 6.0, in favor of
addFixedRateTask(Runnable, Duration)
Add a |
| public void | addFixedRateTask(Runnable task, Duration interval)
Add a |
| public void | |
| public void | addOneTimeTask(Runnable task, Duration initialDelay)
Add a Runnable task to be triggered once after the given initial delay. |
| public void | |
| private void | |
| public void | addTriggerTask(Runnable task, Trigger trigger)
Add a Runnable task to be triggered per the given |
| public void | |
| public void | afterPropertiesSet()
Implements org. Calls |
| public void | destroy()
Implements org. Invoked by the containing |
| public List | Returns: the list of tasks (nevernull)Get the cron tasks as an unmodifiable list of |
| public List | Returns: the list of tasks (nevernull)Get the fixed-delay tasks as an unmodifiable list of |
| public List | Returns: the list of tasks (nevernull)Get the fixed-rate tasks as an unmodifiable list of |
| public ObservationRegistry | |
| public Set | getScheduledTasks()
Implements org. Return all locally registered tasks that have been scheduled by this registrar. |
| public TaskScheduler | |
| public List | Returns: the list of tasks (nevernull)Get the trigger tasks as an unmodifiable list of |
| public boolean | |
| public ScheduledTask | Returns: a handle to the scheduled task, allowing to cancel it (ornull if processing a previously registered task)Schedule the specified cron task, either right away if possible or on initialization of the scheduler. |
| public ScheduledTask | Returns: a handle to the scheduled task, allowing to cancel it (ornull if processing a previously registered task)Schedule the specified fixed-delay task, either right away if possible or on initialization of the scheduler. |
| public ScheduledTask | Returns: a handle to the scheduled task, allowing to cancel it (ornull if processing a previously registered task)Schedule the specified fixed-rate task, either right away if possible or on initialization of the scheduler. |
| public ScheduledTask | Returns: a handle to the scheduled task, allowing to cancel it (ornull if processing a previously registered task)Schedule the specified one-time task, either right away if possible or on initialization of the scheduler. |
| protected void | |
| public ScheduledTask | Returns: a handle to the scheduled task, allowing to cancel itSchedule the specified trigger task, either right away if possible or on initialization of the scheduler. |
| public void | setCronTasks(Map<Runnable, String> cronTasks)
Specify triggered tasks as a Map of Runnables (the tasks) and cron expressions. |
| public void | |
| public void | setFixedDelayTasks(Map<Runnable, Long> fixedDelayTasks)
Specify triggered tasks as a Map of Runnables (the tasks) and fixed-delay values. |
| public void | setFixedDelayTasksList(List<IntervalTask> fixedDelayTasks)
Specify fixed-delay tasks as a list of |
| public void | setFixedRateTasks(Map<Runnable, Long> fixedRateTasks)
Specify triggered tasks as a Map of Runnables (the tasks) and fixed-rate values. |
| public void | setFixedRateTasksList(List<IntervalTask> fixedRateTasks)
Specify fixed-rate tasks as a list of |
| public void | setObservationRegistry(ObservationRegistry observationRegistry)
Configure an |
| public void | setScheduler(Object scheduler)
Set the |
| public void | setTaskScheduler(TaskScheduler taskScheduler)
Set the |
| public void | setTriggerTasks(Map<Runnable, Trigger> triggerTasks)
Specify triggered tasks as a Map of Runnables (the tasks) and Trigger objects
(typically custom implementations of the |
| public void | setTriggerTasksList(List<TriggerTask> triggerTasks)
Specify triggered tasks as a list of |
| CRON_DISABLED | back to summary |
|---|---|
| public static final String CRON_DISABLED A special cron expression value that indicates a disabled trigger: -. This is primarily meant for use with
| |
| cronTasks | back to summary |
|---|---|
| private List<CronTask> cronTasks
| |
| fixedDelayTasks | back to summary |
|---|---|
| private List<IntervalTask> fixedDelayTasks
| |
| fixedRateTasks | back to summary |
|---|---|
| private List<IntervalTask> fixedRateTasks
| |
| localExecutor | back to summary |
|---|---|
| private ScheduledExecutorService localExecutor
| |
| observationRegistry | back to summary |
|---|---|
| private ObservationRegistry observationRegistry
| |
| oneTimeTasks | back to summary |
|---|---|
| private List<DelayedTask> oneTimeTasks
| |
| scheduledTasks | back to summary |
|---|---|
| private final Set<ScheduledTask> scheduledTasks | |
| taskScheduler | back to summary |
|---|---|
| private TaskScheduler taskScheduler
| |
| triggerTasks | back to summary |
|---|---|
| private List<TriggerTask> triggerTasks
| |
| unresolvedTasks | back to summary |
|---|---|
| private final Map<Task, ScheduledTask> unresolvedTasks | |
| ScheduledTaskRegistrar | back to summary |
|---|---|
| public ScheduledTaskRegistrar() | |
| addCronTask | back to summary |
|---|---|
| public void addCronTask(Runnable task, String expression) Add a As of Spring Framework 5.2, this method will not register the task if the
| |
| addCronTask | back to summary |
|---|---|
| public void addCronTask(CronTask task) Add a
| |
| addFixedDelayTask | back to summary |
|---|---|
| public void addFixedDelayTask(Runnable task, long interval)
Add a Runnable task to be triggered with the given fixed delay.
| |
| addFixedDelayTask | back to summary |
|---|---|
| public void addFixedDelayTask(Runnable task, Duration interval) Add a Runnable task to be triggered with the given fixed delay.
| |
| addFixedDelayTask | back to summary |
|---|---|
| public void addFixedDelayTask(IntervalTask task) Add a fixed-delay
| |
| addFixedRateTask | back to summary |
|---|---|
| public void addFixedRateTask(Runnable task, long interval)
Add a
| |
| addFixedRateTask | back to summary |
|---|---|
| public void addFixedRateTask(Runnable task, Duration interval) Add a
| |
| addFixedRateTask | back to summary |
|---|---|
| public void addFixedRateTask(IntervalTask task) Add a fixed-rate
| |
| addOneTimeTask | back to summary |
|---|---|
| public void addOneTimeTask(Runnable task, Duration initialDelay) Add a Runnable task to be triggered once after the given initial delay.
| |
| addOneTimeTask | back to summary |
|---|---|
| public void addOneTimeTask(DelayedTask task) Add a one-time
| |
| addScheduledTask | back to summary |
|---|---|
| private void addScheduledTask(ScheduledTask task) | |
| addTriggerTask | back to summary |
|---|---|
| public void addTriggerTask(Runnable task, Trigger trigger) Add a Runnable task to be triggered per the given | |
| addTriggerTask | back to summary |
|---|---|
| public void addTriggerTask(TriggerTask task) Add a
| |
| afterPropertiesSet | back to summary |
|---|---|
| public void afterPropertiesSet() Implements org. Calls
| |
| destroy | back to summary |
|---|---|
| public void destroy() Implements org. Doc from org. Invoked by the containing
| |
| getCronTaskList | back to summary |
|---|---|
| public List Get the cron tasks as an unmodifiable list of | |
| getFixedDelayTaskList | back to summary |
|---|---|
| public List Get the fixed-delay tasks as an unmodifiable list of
| |
| getFixedRateTaskList | back to summary |
|---|---|
| public List Get the fixed-rate tasks as an unmodifiable list of
| |
| getObservationRegistry | back to summary |
|---|---|
| public ObservationRegistry getObservationRegistry() Return the
| |
| getScheduledTasks | back to summary |
|---|---|
| public Set Implements org. Return all locally registered tasks that have been scheduled by this registrar.
| |
| getScheduler | back to summary |
|---|---|
| public TaskScheduler getScheduler() Return the
| |
| getTriggerTaskList | back to summary |
|---|---|
| public List Get the trigger tasks as an unmodifiable list of
| |
| hasTasks | back to summary |
|---|---|
| public boolean hasTasks() Return whether this
| |
| scheduleCronTask | back to summary |
|---|---|
| public ScheduledTask scheduleCronTask(CronTask task) Schedule the specified cron task, either right away if possible or on initialization of the scheduler.
| |
| scheduleFixedDelayTask | back to summary |
|---|---|
| public ScheduledTask scheduleFixedDelayTask(FixedDelayTask task) Schedule the specified fixed-delay task, either right away if possible or on initialization of the scheduler.
| |
| scheduleFixedRateTask | back to summary |
|---|---|
| public ScheduledTask scheduleFixedRateTask(FixedRateTask task) Schedule the specified fixed-rate task, either right away if possible or on initialization of the scheduler.
| |
| scheduleOneTimeTask | back to summary |
|---|---|
| public ScheduledTask scheduleOneTimeTask(OneTimeTask task) Schedule the specified one-time task, either right away if possible or on initialization of the scheduler.
| |
| scheduleTasks | back to summary |
|---|---|
| protected void scheduleTasks() Schedule all registered tasks against the underlying task scheduler. | |
| scheduleTriggerTask | back to summary |
|---|---|
| public ScheduledTask scheduleTriggerTask(TriggerTask task) Schedule the specified trigger task, either right away if possible or on initialization of the scheduler.
| |
| setCronTasks | back to summary |
|---|---|
| public void setCronTasks(Map<Runnable, String> cronTasks) Specify triggered tasks as a Map of Runnables (the tasks) and cron expressions.
| |
| setCronTasksList | back to summary |
|---|---|
| public void setCronTasksList(List<CronTask> cronTasks) Specify triggered tasks as a list of
| |
| setFixedDelayTasks | back to summary |
|---|---|
| public void setFixedDelayTasks(Map<Runnable, Long> fixedDelayTasks) Specify triggered tasks as a Map of Runnables (the tasks) and fixed-delay values. | |
| setFixedDelayTasksList | back to summary |
|---|---|
| public void setFixedDelayTasksList(List<IntervalTask> fixedDelayTasks) Specify fixed-delay tasks as a list of
| |
| setFixedRateTasks | back to summary |
|---|---|
| public void setFixedRateTasks(Map<Runnable, Long> fixedRateTasks) Specify triggered tasks as a Map of Runnables (the tasks) and fixed-rate values. | |
| setFixedRateTasksList | back to summary |
|---|---|
| public void setFixedRateTasksList(List<IntervalTask> fixedRateTasks) Specify fixed-rate tasks as a list of
| |
| setObservationRegistry | back to summary |
|---|---|
| public void setObservationRegistry(ObservationRegistry observationRegistry) Configure an
| |
| setScheduler | back to summary |
|---|---|
| public void setScheduler(Object scheduler) Set the | |
| setTaskScheduler | back to summary |
|---|---|
| public void setTaskScheduler(TaskScheduler taskScheduler) Set the | |
| setTriggerTasks | back to summary |
|---|---|
| public void setTriggerTasks(Map<Runnable, Trigger> triggerTasks) Specify triggered tasks as a Map of Runnables (the tasks) and Trigger objects
(typically custom implementations of the | |
| setTriggerTasksList | back to summary |
|---|---|
| public void setTriggerTasksList(List<TriggerTask> triggerTasks) Specify triggered tasks as a list of
| |