| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.concurrent.Executors; |
| | | import java.util.concurrent.ScheduledExecutorService; |
| | | import java.util.concurrent.ScheduledThreadPoolExecutor; |
| | | |
| | | @Configuration |
| | | @EnableScheduling |
| | |
| | | public void configureTasks(ScheduledTaskRegistrar taskRegistrar) { |
| | | DynamicSchedulingConfig.static_scheduledTaskRegistrar = taskRegistrar; |
| | | |
| | | taskRegistrar.setScheduler(Executors.newScheduledThreadPool(1)); |
| | | ScheduledThreadPoolExecutor scheduledThreadPoolExecutor = new ScheduledThreadPoolExecutor(1); |
| | | scheduledThreadPoolExecutor.setRemoveOnCancelPolicy(true); |
| | | taskRegistrar.setScheduler(scheduledThreadPoolExecutor); |
| | | } |
| | | } |