Class ThreadPoolTaskScheduler

All Implemented Interfaces:
Serializable, Executor, ThreadFactory, EventListener, Aware, BeanNameAware, DisposableBean, InitializingBean, ApplicationContextAware, ApplicationListener<ContextClosedEvent>, Lifecycle, Phased, SmartLifecycle, AsyncListenableTaskExecutor, AsyncTaskExecutor, TaskExecutor, SchedulingTaskExecutor, TaskScheduler

public class ThreadPoolTaskScheduler extends ExecutorConfigurationSupport implements AsyncListenableTaskExecutor, SchedulingTaskExecutor, TaskScheduler
A standard implementation of Spring's TaskScheduler interface, wrapping a native ScheduledThreadPoolExecutor and providing all applicable configuration options for it. The default number of scheduler threads is 1; a higher number can be configured through setPoolSize(int).

This is Spring's traditional scheduler variant, staying as close as possible to ScheduledExecutorService semantics. Task execution happens on the scheduler thread(s) rather than on separate execution threads. As a consequence, a ScheduledFuture handle (e.g. from schedule(Runnable, Instant)) represents the actual completion of the provided task (or series of repeated tasks).

Juergen Hoeller, Mark Fisher
See Also: