|
|
@@ -17,9 +17,9 @@ public class TaskExecutePool {
|
|
|
@Bean
|
|
|
public Executor heartTaskAsyncPool() {
|
|
|
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
|
|
- executor.setCorePoolSize(4); //核心线程数
|
|
|
- executor.setMaxPoolSize(8); //最大线程数
|
|
|
- executor.setQueueCapacity(1000); //队列大小
|
|
|
+ executor.setCorePoolSize(1); //核心线程数
|
|
|
+ executor.setMaxPoolSize(1); //最大线程数
|
|
|
+ executor.setQueueCapacity(0); //队列大小
|
|
|
executor.setKeepAliveSeconds(300); //线程最大空闲时间
|
|
|
executor.setThreadNamePrefix("async-heartExecutor-");
|
|
|
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); // 拒绝策略(一共四种,此处省略)
|
|
|
@@ -29,9 +29,9 @@ public class TaskExecutePool {
|
|
|
@Bean
|
|
|
public Executor charngingTaskAsyncPool() {
|
|
|
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
|
|
- executor.setCorePoolSize(4); //核心线程数
|
|
|
- executor.setMaxPoolSize(8); //最大线程数
|
|
|
- executor.setQueueCapacity(1000); //队列大小
|
|
|
+ executor.setCorePoolSize(1); //核心线程数
|
|
|
+ executor.setMaxPoolSize(1); //最大线程数
|
|
|
+ executor.setQueueCapacity(0); //队列大小
|
|
|
executor.setKeepAliveSeconds(300); //线程最大空闲时间
|
|
|
executor.setThreadNamePrefix("async-charngingExecutor-");
|
|
|
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); // 拒绝策略(一共四种,此处省略)
|
|
|
@@ -41,9 +41,9 @@ public class TaskExecutePool {
|
|
|
@Bean
|
|
|
public Executor freeTaskAsyncPool() {
|
|
|
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
|
|
- executor.setCorePoolSize(4); //核心线程数
|
|
|
- executor.setMaxPoolSize(8); //最大线程数
|
|
|
- executor.setQueueCapacity(1000); //队列大小
|
|
|
+ executor.setCorePoolSize(1); //核心线程数
|
|
|
+ executor.setMaxPoolSize(1); //最大线程数
|
|
|
+ executor.setQueueCapacity(0); //队列大小
|
|
|
executor.setKeepAliveSeconds(300); //线程最大空闲时间
|
|
|
executor.setThreadNamePrefix("async-freeExecutor-");
|
|
|
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); // 拒绝策略(一共四种,此处省略)
|
|
|
@@ -53,9 +53,9 @@ public class TaskExecutePool {
|
|
|
@Bean
|
|
|
public Executor transactionTaskAsyncPool() {
|
|
|
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
|
|
- executor.setCorePoolSize(4); //核心线程数
|
|
|
- executor.setMaxPoolSize(8); //最大线程数
|
|
|
- executor.setQueueCapacity(1000); //队列大小
|
|
|
+ executor.setCorePoolSize(1); //核心线程数
|
|
|
+ executor.setMaxPoolSize(1); //最大线程数
|
|
|
+ executor.setQueueCapacity(0); //队列大小
|
|
|
executor.setKeepAliveSeconds(300); //线程最大空闲时间
|
|
|
executor.setThreadNamePrefix("async-transactionExecutor-");
|
|
|
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); // 拒绝策略(一共四种,此处省略)
|