Deprecated
as a consequence of ConcurrentTaskExecutor being deprecated. See corresponding docs for further information.
java.util.concurrent.ScheduledExecutorService and
exposes a Spring org.springframework.scheduling.TaskScheduler for it.
Extends ConcurrentTaskExecutor in order to implement the
org.springframework.scheduling.SchedulingTaskExecutor interface as well.
Autodetects a JSR-236 jakarta.
in order to use it for trigger-based scheduling if possible, instead of Spring's
local trigger management which ends up delegating to regular delay-based scheduling
against the java.util.concurrent.ScheduledExecutorService API. For JSR-236 style
lookup in a Jakarta EE environment, consider using DefaultManagedTaskScheduler.
Note that there is a pre-built ThreadPoolTaskScheduler that allows for
defining a java. in bean style,
exposing it as a Spring org. directly.
This is a convenient alternative to a raw ScheduledThreadPoolExecutor definition with
a separate definition of the present adapter class.
java.util.concurrent.ScheduledExecutorService , java.util.concurrent.ScheduledThreadPoolExecutor , java.util.concurrent.Executors , DefaultManagedTaskScheduler, ThreadPoolTaskScheduler
| Modifier and Type | Class and Description |
|---|---|
| private class | ConcurrentTaskScheduler.EnterpriseConcurrentTriggerScheduler
Delegate that adapts a Spring Trigger to a JSR-236 Trigger. |
| Modifier and Type | Field and Description |
|---|---|
| private Clock | |
| private boolean | |
| private ErrorHandler | |
| private static Class | |
| private static final TimeUnit | |
| private ScheduledExecutorService |
| Modifier and Type | Method and Description |
|---|---|
| private Runnable | |
| public Clock | getClock()
Overrides default org. |
| private ScheduledExecutorService | |
| private void | |
| public ScheduledFuture | schedule(Runnable
the Runnable to execute whenever the trigger fires task, Trigger an implementation of the trigger)Trigger interface,
e.g. a org. object
wrapping a cron expressionImplements org. Runnable, invoking it whenever the trigger
indicates a next execution time.
|
| public ScheduledFuture | schedule(Runnable
the Runnable to execute whenever the trigger fires task, Instant the desired execution time for the task
(if this is in the past, the task will be executed immediately, i.e. as soon as possible) startTime)Implements org. Runnable, invoking it at the specified execution time.
|
| public ScheduledFuture | scheduleAtFixedRate(Runnable
the Runnable to execute whenever the trigger fires task, Instant the desired first execution time for the task
(if this is in the past, the task will be executed immediately, i.e. as soon as possible) startTime, Duration the interval between successive executions of the task period)Implements org. Runnable, invoking it at the specified execution time
and subsequently with the given period.
|
| public ScheduledFuture | scheduleAtFixedRate(Runnable
the Runnable to execute whenever the trigger fires task, Duration the interval between successive executions of the task period)Implements org. Runnable, starting as soon as possible and
invoking it with the given period.
|
| public ScheduledFuture | scheduleWithFixedDelay(Runnable
the Runnable to execute whenever the trigger fires task, Instant the desired first execution time for the task
(if this is in the past, the task will be executed immediately, i.e. as soon as possible) startTime, Duration the delay between the completion of one execution and the start of the next delay)Implements org. Runnable, invoking it at the specified execution time
and subsequently with the given delay between the completion of one execution
and the start of the next.
|
| public ScheduledFuture | scheduleWithFixedDelay(Runnable
the Runnable to execute whenever the trigger fires task, Duration the delay between the completion of one execution and the start of the next delay)Implements org. Runnable, starting as soon as possible and invoking it with
the given delay between the completion of one execution and the start of the next.
|
| public void | |
| public void | |
| public void | setScheduledExecutor(ScheduledExecutorService scheduledExecutor)
Specify the |
| clock | back to summary |
|---|---|
| private Clock clock | |
| enterpriseConcurrentScheduler | back to summary |
|---|---|
| private boolean enterpriseConcurrentScheduler | |
| errorHandler | back to summary |
|---|---|
| private ErrorHandler errorHandler
| |
| managedScheduledExecutorServiceClass | back to summary |
|---|---|
| private static Class<?> managedScheduledExecutorServiceClass
| |
| NANO | back to summary |
|---|---|
| private static final TimeUnit NANO | |
| scheduledExecutor | back to summary |
|---|---|
| private ScheduledExecutorService scheduledExecutor
| |
| ConcurrentTaskScheduler | back to summary |
|---|---|
| public ConcurrentTaskScheduler()
Deprecated since 6.1. in favor of Create a new ConcurrentTaskScheduler, using a single thread executor as default.
| |
| ConcurrentTaskScheduler | back to summary |
|---|---|
| public ConcurrentTaskScheduler(ScheduledExecutorService scheduledExecutor) Create a new ConcurrentTaskScheduler, using the given
Autodetects a JSR-236
| |
| ConcurrentTaskScheduler | back to summary |
|---|---|
| public ConcurrentTaskScheduler(Executor concurrentExecutor, ScheduledExecutorService scheduledExecutor) Create a new ConcurrentTaskScheduler, using the given Autodetects a JSR-236
| |
| decorateTask | back to summary |
|---|---|
| private Runnable decorateTask(Runnable task, boolean isRepeatingTask) | |
| getClock | back to summary |
|---|---|
| public Clock getClock() Overrides default org. Doc from org. Return the clock to use for scheduling purposes.
| |
| getScheduledExecutor | back to summary |
|---|---|
| private ScheduledExecutorService getScheduledExecutor() | |
| initScheduledExecutor | back to summary |
|---|---|
| private void initScheduledExecutor(ScheduledExecutorService scheduledExecutor) | |
| schedule | back to summary |
|---|---|
| public ScheduledFuture Implements org. Doc from org. Schedule the given Execution will end once the scheduler shuts down or the returned
| |
| schedule | back to summary |
|---|---|
| public ScheduledFuture Implements org. Doc from org. Schedule the given Execution will end once the scheduler shuts down or the returned
| |
| scheduleAtFixedRate | back to summary |
|---|---|
| public ScheduledFuture Implements org. Doc from org. Schedule the given Execution will end once the scheduler shuts down or the returned
| |
| scheduleAtFixedRate | back to summary |
|---|---|
| public ScheduledFuture Implements org. Doc from org. Schedule the given Execution will end once the scheduler shuts down or the returned
| |
| scheduleWithFixedDelay | back to summary |
|---|---|
| public ScheduledFuture Implements org. Doc from org. Schedule the given Execution will end once the scheduler shuts down or the returned
| |
| scheduleWithFixedDelay | back to summary |
|---|---|
| public ScheduledFuture Implements org. Doc from org. Schedule the given Execution will end once the scheduler shuts down or the returned
| |
| setClock | back to summary |
|---|---|
| public void setClock(Clock clock) Set the clock to use for scheduling purposes. The default clock is the system clock for the default time zone.
| |
| setErrorHandler | back to summary |
|---|---|
| public void setErrorHandler(ErrorHandler errorHandler) Provide an | |
| setScheduledExecutor | back to summary |
|---|---|
| public void setScheduledExecutor(ScheduledExecutorService scheduledExecutor) Specify the Autodetects a JSR-236 Note This will only apply to
| |
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public ScheduledFuture |
| EnterpriseConcurrentTriggerScheduler | back to summary |
|---|---|
| private EnterpriseConcurrentTriggerScheduler() | |
| schedule | back to summary |
|---|---|
| public ScheduledFuture | |
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Date | getNextRunTime(LastExecution
information about the last execution of the task.
This value will be null if the task has not yet run. le, Date the date/time in which the task was scheduled using
the taskScheduledTime)ManagedScheduledExecutorService.schedule
method.Implements jakarta. |
| public boolean | skipRun(LastExecution
information about the last execution of the task.
This value will be null if the task has not yet run. lastExecutionInfo, Date the date/time that the task was originally scheduled
to run. scheduledRunTime)Implements jakarta. |
| adaptee | back to summary |
|---|---|
| private final Trigger adaptee | |
| TriggerAdapter | back to summary |
|---|---|
| public TriggerAdapter(Trigger adaptee) | |
| getNextRunTime | back to summary |
|---|---|
| public Date getNextRunTime(LastExecution le, Date taskScheduledTime) Implements jakarta. Doc from jakarta. Retrieve the next time that the task should run after.
| |
| skipRun | back to summary |
|---|---|
| public boolean skipRun(LastExecution lastExecutionInfo, Date scheduledRunTime) Implements jakarta. Doc from jakarta. Return true if this run instance should be skipped. This is useful if the task shouldn't run because it is late or if the task is paused or suspended.
Once this task is skipped, the state of it's Future's result will throw a
| |
| Modifier and Type | Field and Description |
|---|---|
| private final LastExecution |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Instant | lastActualExecution()
Implements org. null if not scheduled before.
|
| public Instant | lastCompletion()
Implements org. null if not scheduled before.
|
| public Instant | lastScheduledExecution()
Implements org. null if not scheduled before.
|
| private static Instant |
| le | back to summary |
|---|---|
| private final LastExecution le
| |
| LastExecutionAdapter | back to summary |
|---|---|
| public LastExecutionAdapter(LastExecution le) | |
| lastActualExecution | back to summary |
|---|---|
| public Instant lastActualExecution() Implements org. Doc from org. Return the last actual execution time of the task,
or
| |
| lastCompletion | back to summary |
|---|---|
| public Instant lastCompletion() Implements org. Doc from org. Return the last completion time of the task,
or
| |
| lastScheduledExecution | back to summary |
|---|---|
| public Instant lastScheduledExecution() Implements org. Doc from org. Return the last scheduled execution time of the task,
or
| |
| toInstant | back to summary |
|---|---|
private static Instant toInstant(Date date)
| |