|  |  | 
 |  |  | import java.util.concurrent.ThreadPoolExecutor; | 
 |  |  |  | 
 |  |  | @Configuration | 
 |  |  | @EnableAsync | 
 |  |  | @EnableAsync(proxyTargetClass = true) | 
 |  |  | public class ThreadPoolTaskConfig { | 
 |  |  |  | 
 |  |  |     public static final int cpuNum = Runtime.getRuntime().availableProcessors(); | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      *   默认情况下,在创建了线程池后,线程池中的线程数为0,当有任务来之后,就会创建一个线程去执行任务, | 
 |  |  | 
 |  |  |     /** | 
 |  |  |      * 核心线程数(默认线程数) | 
 |  |  |      */ | 
 |  |  |     private static final int corePoolSize = 5; | 
 |  |  |     private static final int corePoolSize = cpuNum; | 
 |  |  |     /** | 
 |  |  |      * 最大线程数 | 
 |  |  |      */ | 
 |  |  |     private static final int maxPoolSize = 30; | 
 |  |  |     private static final int maxPoolSize = cpuNum*2; | 
 |  |  |     /** | 
 |  |  |      * 允许线程空闲时间(单位:默认为秒) | 
 |  |  |      */ | 
 |  |  | 
 |  |  |     /** | 
 |  |  |      * 缓冲队列大小 | 
 |  |  |      */ | 
 |  |  |     private static final int queueCapacity = 10000; | 
 |  |  |     private static final int queueCapacity = 500; | 
 |  |  |     /** | 
 |  |  |      * 线程池名前缀 | 
 |  |  |      */ | 
 |  |  |     private static final String threadNamePrefix = "hdl-uhi-service-"; | 
 |  |  |     private static final String threadNamePrefix = "wvp-"; | 
 |  |  |  | 
 |  |  |     @Bean("taskExecutor") // bean的名称,默认为首字母小写的方法名 | 
 |  |  |     public ThreadPoolTaskExecutor taskExecutor() { |