|
@@ -60,4 +60,24 @@ public class ThreadPoolConfig
|
|
|
}
|
|
|
};
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 核心业务线程池子
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Bean("commonAsyncExecutor")
|
|
|
+ public ThreadPoolTaskExecutor commonAsyncExecutor(){
|
|
|
+ ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
|
|
|
+ taskExecutor.setCorePoolSize(10);
|
|
|
+ taskExecutor.setMaxPoolSize(10);
|
|
|
+ taskExecutor.setQueueCapacity(10000);
|
|
|
+ taskExecutor.setKeepAliveSeconds(60);
|
|
|
+ taskExecutor.setThreadNamePrefix("commonAsyncExecutor--");
|
|
|
+ taskExecutor.setWaitForTasksToCompleteOnShutdown(true);
|
|
|
+ taskExecutor.setAwaitTerminationSeconds(60);
|
|
|
+ taskExecutor.setRejectedExecutionHandler(new ThreadPoolExecutor.DiscardPolicy());
|
|
|
+ taskExecutor.initialize();
|
|
|
+ return taskExecutor;
|
|
|
+ }
|
|
|
}
|