| 12345678910111213141516171819202122232425262728293031323334 |
- package com.sqx.scheduler.config;
- import org.springframework.context.annotation.Configuration;
- import org.springframework.scheduling.annotation.AsyncConfigurer;
- import org.springframework.scheduling.annotation.EnableAsync;
- import org.springframework.scheduling.annotation.EnableScheduling;
- import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
- import java.util.concurrent.Executor;
- /**
- * 调度配置
- *
- * @auther: codingliang
- * @date: 2023/5/19 23:15
- * @description: 调度配置
- */
- @EnableAsync
- @EnableScheduling
- @Configuration
- public class ScheduledConfig implements AsyncConfigurer {
- @Override
- public Executor getAsyncExecutor() {
- ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
- executor.setCorePoolSize(10);
- executor.setMaxPoolSize(20);
- executor.setQueueCapacity(50);
- executor.setKeepAliveSeconds(60);
- executor.setThreadNamePrefix("wm-application-task-");
- executor.initialize();
- return executor;
- }
- }
|