Class SchedulerConfig
java.lang.Object
springboot.bg.harisauto.common.config.scheduler.SchedulerConfig
- All Implemented Interfaces:
org.springframework.scheduling.annotation.SchedulingConfigurer
@Configuration
public class SchedulerConfig
extends Object
implements org.springframework.scheduling.annotation.SchedulingConfigurer
SchedulerConfig.java - Configuration for scheduled tasks.
Provides a thread pool for running scheduled jobs concurrently.
- Author:
- Kristian Popov
-
Constructor Summary
ConstructorsConstructorDescriptionSchedulerConfig(org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler taskScheduler) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigureTasks(org.springframework.scheduling.config.ScheduledTaskRegistrar taskRegistrar) Points scheduled tasks at the managed scheduler.static org.springframework.scheduling.concurrent.ThreadPoolTaskSchedulerThe scheduler used for@Scheduledtasks.
-
Constructor Details
-
SchedulerConfig
public SchedulerConfig(org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler taskScheduler) Constructor.
-
-
Method Details
-
taskScheduler
@Bean public static org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler taskScheduler()The scheduler used for@Scheduledtasks.Declared as a bean so the container owns its lifecycle. Built by hand and merely handed to the registrar, it was never destroyed on shutdown, so
waitForTasksToCompleteOnShutdownandawaitTerminationSecondsnever took effect and every devtools restart leaked another pool.- Returns:
- The managed scheduler.
-
configureTasks
public void configureTasks(org.springframework.scheduling.config.ScheduledTaskRegistrar taskRegistrar) Points scheduled tasks at the managed scheduler.- Specified by:
configureTasksin interfaceorg.springframework.scheduling.annotation.SchedulingConfigurer
-