@Configuration @EnableAsync public class ExecutorConfig { private static final int poolSizeMin = 30; @Bean public Executor executor() { ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); String poolSize = "60"; int poolSizeNum = Integer.parseInt(poolSize); if (poolSizeNum < poolSizeMin) { poolSizeNum = poolSizeMin; } executor.setThreadNamePrefix("dataTo-"); executor.setMaxPoolSize(poolSizeNum); executor.setCorePoolSize(poolSizeMin); executor.setQueueCapacity(10); executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); executor.initialize(); return executor; } }
标签:poolSizeNum,poolSizeMin,配置,poolSize,int,线程,executor,new From: https://www.cnblogs.com/wojtek/p/17718415.html