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

    Constructors
    Constructor
    Description
    SchedulerConfig(org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler taskScheduler)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    configureTasks(org.springframework.scheduling.config.ScheduledTaskRegistrar taskRegistrar)
    Points scheduled tasks at the managed scheduler.
    static org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler
    The scheduler used for @Scheduled tasks.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 @Scheduled tasks.

      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 waitForTasksToCompleteOnShutdown and awaitTerminationSeconds never 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:
      configureTasks in interface org.springframework.scheduling.annotation.SchedulingConfigurer