From a89d8e3377faf81e327f041112ffc258572ef9a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E6=AC=A7=EF=BC=88=E6=9E=97=E5=B9=B3=E5=87=A1?= =?UTF-8?q?=EF=BC=89?= Date: Fri, 29 Nov 2024 11:56:41 +0800 Subject: [PATCH] 1 --- src/main/java/cn/van/business/config/AsyncConfig.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/cn/van/business/config/AsyncConfig.java b/src/main/java/cn/van/business/config/AsyncConfig.java index 401cee0..18f6383 100644 --- a/src/main/java/cn/van/business/config/AsyncConfig.java +++ b/src/main/java/cn/van/business/config/AsyncConfig.java @@ -6,6 +6,7 @@ import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import java.util.concurrent.Executor; +import java.util.concurrent.ThreadPoolExecutor; /** * @author Leo @@ -20,11 +21,10 @@ public class AsyncConfig implements AsyncConfigurer { @Override public Executor getAsyncExecutor() { ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); - executor.setCorePoolSize(8); + executor.setCorePoolSize(10); executor.setMaxPoolSize(128); - executor.setQueueCapacity(100); - executor.setThreadNamePrefix("Async-"); + executor.setQueueCapacity(500); + executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); executor.initialize(); - return executor; } }