|  |  | 
 |  |  | @EnableAsync | 
 |  |  | public class ThreadPoolConfig { | 
 |  |  |  | 
 |  |  |     @Bean(name = "orderThreadPool") | 
 |  |  |     @Bean(name = "reportThreadPool") | 
 |  |  |     public ThreadPoolTaskExecutor orderThreadPool() { | 
 |  |  |         ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); | 
 |  |  |         int core = Runtime.getRuntime().availableProcessors(); | 
 |  |  |         core = 2; | 
 |  |  |         core = 1; | 
 |  |  |         //设置核心线程数 | 
 |  |  |         executor.setCorePoolSize(core); | 
 |  |  |         //设置最大线程数 | 
 |  |  |         executor.setMaxPoolSize(core * 10 + core); | 
 |  |  |         executor.setMaxPoolSize(1); | 
 |  |  |         //除核心线程外的线程存活时间 | 
 |  |  |         executor.setKeepAliveSeconds(3); | 
 |  |  |         //缓冲队列 | 
 |  |  |         executor.setQueueCapacity(core); | 
 |  |  |         executor.setThreadNamePrefix("order-task-"); | 
 |  |  |         executor.setThreadNamePrefix("report-task-"); | 
 |  |  |         //设置拒绝策略 | 
 |  |  |         executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); | 
 |  |  |         return executor; |