Class ConcurrentTaskScheduler

java.lang.Object
org.springframework.scheduling.concurrent.ConcurrentTaskExecutor
org.springframework.scheduling.concurrent.ConcurrentTaskScheduler
All Implemented Interfaces:
Executor, AsyncListenableTaskExecutor, AsyncTaskExecutor, TaskExecutor, SchedulingTaskExecutor, TaskScheduler
Direct Known Subclasses:
DefaultManagedTaskScheduler

public class ConcurrentTaskScheduler extends ConcurrentTaskExecutor implements TaskScheduler
Adapter that takes a java.util.concurrent.ScheduledExecutorService and exposes a Spring TaskScheduler for it. Extends ConcurrentTaskExecutor in order to implement the SchedulingTaskExecutor interface as well.

Autodetects a JSR-236 ManagedScheduledExecutorService 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 ScheduledThreadPoolExecutor in bean style, exposing it as a Spring TaskScheduler directly. This is a convenient alternative to a raw ScheduledThreadPoolExecutor definition with a separate definition of the present adapter class.

Since:
3.0
Author:
Juergen Hoeller, Mark Fisher, Arjen Poutsma
See Also: