java.lang.Object | ||||
↳ | org.springframework.util.CustomizableThreadCreator | |||
↳ | org.springframework.scheduling.concurrent.CustomizableThreadFactory | |||
↳ | org.springframework.scheduling.concurrent.ExecutorConfigurationSupport | |||
↳ | org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler |
Implementation of Spring's TaskScheduler
interface, wrapping
a native java.util.concurrent.ScheduledThreadPoolExecutor.
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
org.springframework.core.task.AsyncTaskExecutor
|
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.scheduling.concurrent.ExecutorConfigurationSupport
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Execute the given
task . | |||||||||||
Execute the given
task . | |||||||||||
Return the underlying ScheduledExecutorService for native access.
| |||||||||||
Does this
TaskExecutor prefer short-lived tasks over
long-lived tasks?
A | |||||||||||
Schedule the given
Runnable , invoking it whenever the trigger
indicates a next execution time. | |||||||||||
Schedule the given
Runnable , invoking it at the specified execution time. | |||||||||||
Schedule the given
Runnable , invoking it at the specified execution time
and subsequently with the given period. | |||||||||||
Schedule the given
Runnable , starting as soon as possible and
invoking it with the given period. | |||||||||||
Schedule the given
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. | |||||||||||
Schedule the given
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. | |||||||||||
Provide an
ErrorHandler strategy. | |||||||||||
Set the ScheduledExecutorService's pool size.
| |||||||||||
Submit a Callable task for execution, receiving a Future representing that task.
| |||||||||||
Submit a Runnable task for execution, receiving a Future representing that task.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create a new
ScheduledExecutorService instance. | |||||||||||
Create the target
ExecutorService instance. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.scheduling.concurrent.ExecutorConfigurationSupport
| |||||||||||
From class
org.springframework.scheduling.concurrent.CustomizableThreadFactory
| |||||||||||
From class
org.springframework.util.CustomizableThreadCreator
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
java.util.concurrent.Executor
| |||||||||||
From interface
java.util.concurrent.ThreadFactory
| |||||||||||
From interface
org.springframework.beans.factory.BeanNameAware
| |||||||||||
From interface
org.springframework.beans.factory.DisposableBean
| |||||||||||
From interface
org.springframework.beans.factory.InitializingBean
| |||||||||||
From interface
org.springframework.core.task.AsyncTaskExecutor
| |||||||||||
From interface
org.springframework.core.task.TaskExecutor
| |||||||||||
From interface
org.springframework.scheduling.SchedulingTaskExecutor
| |||||||||||
From interface
org.springframework.scheduling.TaskScheduler
|
Execute the given task
.
The call might return immediately if the implementation uses an asynchronous execution strategy, or might block in the case of synchronous execution.
task | the Runnable to execute (never null ) |
---|
Execute the given task
.
task | the Runnable to execute (never null ) |
---|---|
startTimeout | the time duration (milliseconds) within which the task is
supposed to start. This is intended as a hint to the executor, allowing for
preferred handling of immediate tasks. Typical values are TIMEOUT_IMMEDIATE
or TIMEOUT_INDEFINITE (the default as used by execute(Runnable) ). |
Return the underlying ScheduledExecutorService for native access.
null
)IllegalStateException | if the ThreadPoolTaskScheduler hasn't been initialized yet |
---|
Does this TaskExecutor
prefer short-lived tasks over
long-lived tasks?
A SchedulingTaskExecutor
implementation can indicate
whether it prefers submitted tasks to perform as little work as they
can within a single task execution. For example, submitted tasks
might break a repeated loop into individual subtasks which submit a
follow-up task afterwards (if feasible).
This should be considered a hint. Of course TaskExecutor
clients are free to ignore this flag and hence the
SchedulingTaskExecutor
interface overall. However, thread
pools will usually indicated a preference for short-lived tasks, to be
able to perform more fine-grained scheduling.
true
if this TaskExecutor
prefers
short-lived tasks
Schedule the given Runnable
, invoking it whenever the trigger
indicates a next execution time.
Execution will end once the scheduler shuts down or the returned
ScheduledFuture
gets cancelled.
task | the Runnable to execute whenever the trigger fires |
---|---|
trigger | an implementation of the Trigger interface,
e.g. a CronTrigger object
wrapping a cron expression |
ScheduledFuture
representing pending completion of the task,
or null
if the given Trigger object never fires (i.e. returns
null
from nextExecutionTime(TriggerContext)
)Schedule the given Runnable
, invoking it at the specified execution time.
Execution will end once the scheduler shuts down or the returned
ScheduledFuture
gets cancelled.
task | the Runnable to execute whenever the trigger fires |
---|---|
startTime | 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) |
ScheduledFuture
representing pending completion of the taskSchedule the given Runnable
, invoking it at the specified execution time
and subsequently with the given period.
Execution will end once the scheduler shuts down or the returned
ScheduledFuture
gets cancelled.
task | the Runnable to execute whenever the trigger fires |
---|---|
startTime | 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) |
period | the interval between successive executions of the task (in milliseconds) |
ScheduledFuture
representing pending completion of the taskSchedule the given Runnable
, starting as soon as possible and
invoking it with the given period.
Execution will end once the scheduler shuts down or the returned
ScheduledFuture
gets cancelled.
task | the Runnable to execute whenever the trigger fires |
---|---|
period | the interval between successive executions of the task (in milliseconds) |
ScheduledFuture
representing pending completion of the taskSchedule the given 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.
Execution will end once the scheduler shuts down or the returned
ScheduledFuture
gets cancelled.
task | the Runnable to execute whenever the trigger fires |
---|---|
startTime | 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) |
delay | the delay between the completion of one execution and the start of the next (in milliseconds) |
ScheduledFuture
representing pending completion of the taskSchedule the given 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.
Execution will end once the scheduler shuts down or the returned
ScheduledFuture
gets cancelled.
task | the Runnable to execute whenever the trigger fires |
---|---|
delay | the interval between successive executions of the task (in milliseconds) |
ScheduledFuture
representing pending completion of the taskSet the ScheduledExecutorService's pool size. Default is 1.
Submit a Callable task for execution, receiving a Future representing that task. The Future will return the Callable's result upon completion.
task | the Callable to execute (never null ) |
---|
Submit a Runnable task for execution, receiving a Future representing that task.
The Future will return a null
result upon completion.
task | the Runnable to execute (never null ) |
---|
Create a new ScheduledExecutorService
instance.
The default implementation creates a ScheduledThreadPoolExecutor.
Can be overridden in subclasses to provide custom ScheduledExecutorService
instances.
poolSize | the specified pool size |
---|---|
threadFactory | the ThreadFactory to use |
rejectedExecutionHandler | the RejectedExecutionHandler to use |
afterPropertiesSet()
Create the target ExecutorService
instance.
Called by afterPropertiesSet
.
threadFactory | the ThreadFactory to use |
---|---|
rejectedExecutionHandler | the RejectedExecutionHandler to use |