多余代码
This commit is contained in:
parent
d1b7203d19
commit
64e069f469
|
|
@ -1,35 +0,0 @@
|
|||
package com.czg.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
|
||||
/**
|
||||
* @author ww
|
||||
* @description
|
||||
*/
|
||||
@Configuration
|
||||
public class AsyncConfig {
|
||||
|
||||
@Bean
|
||||
public ThreadPoolTaskExecutor asyncExecutor() {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
// 核心线程数(根据CPU核心数调整,一般为CPU核心数 * 2)
|
||||
executor.setCorePoolSize(8);
|
||||
// 最大线程数
|
||||
executor.setMaxPoolSize(16);
|
||||
// 队列容量
|
||||
executor.setQueueCapacity(1000);
|
||||
// 线程空闲时间(秒)
|
||||
executor.setKeepAliveSeconds(60);
|
||||
// 线程名称前缀
|
||||
executor.setThreadNamePrefix("print-delay-");
|
||||
// 拒绝策略(当任务满时,由提交任务的线程执行)
|
||||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
// 初始化线程池
|
||||
executor.initialize();
|
||||
return executor;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue