From e7e00697a78ed7a5aa295d0104c89329eb2739c0 Mon Sep 17 00:00:00 2001 From: linzhijie <1003392067@qq.com> Date: 星期五, 21 十月 2022 08:50:43 +0800 Subject: [PATCH] 线程更改 --- src/main/java/com/ots/framework/config/ThreadPoolConfig.java | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/ots/framework/config/ThreadPoolConfig.java b/src/main/java/com/ots/framework/config/ThreadPoolConfig.java index 4293f31..580fc80 100644 --- a/src/main/java/com/ots/framework/config/ThreadPoolConfig.java +++ b/src/main/java/com/ots/framework/config/ThreadPoolConfig.java @@ -11,13 +11,14 @@ @Configuration public class ThreadPoolConfig { - private int corePoolSize = 50; + private int corePoolSize = 4; - private int maxPoolSize = 200; + private int maxPoolSize = 20; - private int queueCapacity = 1000; + private int queueCapacity = 100; - private int keepAliveSeconds = 300; + private int keepAliveSeconds = 60; + @Bean(name = "threadPoolTaskExecutor") public ThreadPoolTaskExecutor threadPoolTaskExecutor() { ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); @@ -25,6 +26,8 @@ executor.setCorePoolSize(corePoolSize); executor.setQueueCapacity(queueCapacity); executor.setKeepAliveSeconds(keepAliveSeconds); + //绾跨▼鍓嶇紑鍚嶇О + executor.setThreadNamePrefix("thread-pool-%d"); executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); return executor; -- Gitblit v1.9.1