From 1d753b48c023090430c2931fd8e3a45a382eddf8 Mon Sep 17 00:00:00 2001 From: hotcoffie <35990065+hotcoffie@users.noreply.github.com> Date: 星期二, 17 五月 2022 11:53:42 +0800 Subject: [PATCH] Merge branch '648540858:wvp-28181-2.0' into wvp-28181-2.0 --- src/main/java/com/genersoft/iot/vmp/conf/ThreadPoolTaskConfig.java | 19 +++++++++++++++---- 1 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/conf/ThreadPoolTaskConfig.java b/src/main/java/com/genersoft/iot/vmp/conf/ThreadPoolTaskConfig.java index f2edf04..7377702 100644 --- a/src/main/java/com/genersoft/iot/vmp/conf/ThreadPoolTaskConfig.java +++ b/src/main/java/com/genersoft/iot/vmp/conf/ThreadPoolTaskConfig.java @@ -7,9 +7,15 @@ import java.util.concurrent.ThreadPoolExecutor; +/** + * ThreadPoolTask 閰嶇疆绫� + * @author lin + */ @Configuration -@EnableAsync +@EnableAsync(proxyTargetClass = true) public class ThreadPoolTaskConfig { + + public static final int cpuNum = Runtime.getRuntime().availableProcessors(); /** * 榛樿鎯呭喌涓嬶紝鍦ㄥ垱寤轰簡绾跨▼姹犲悗锛岀嚎绋嬫睜涓殑绾跨▼鏁颁负0锛屽綋鏈変换鍔℃潵涔嬪悗锛屽氨浼氬垱寤轰竴涓嚎绋嬪幓鎵ц浠诲姟锛� @@ -20,15 +26,16 @@ /** * 鏍稿績绾跨▼鏁帮紙榛樿绾跨▼鏁帮級 */ - private static final int corePoolSize = 5; + private static final int corePoolSize = cpuNum; /** * 鏈�澶х嚎绋嬫暟 */ - private static final int maxPoolSize = 30; + private static final int maxPoolSize = cpuNum*2; /** * 鍏佽绾跨▼绌洪棽鏃堕棿锛堝崟浣嶏細榛樿涓虹锛� */ private static final int keepAliveTime = 30; + /** * 缂撳啿闃熷垪澶у皬 */ @@ -36,8 +43,12 @@ /** * 绾跨▼姹犲悕鍓嶇紑 */ - private static final String threadNamePrefix = "hdl-uhi-service-"; + private static final String threadNamePrefix = "wvp-"; + /** + * + * @return + */ @Bean("taskExecutor") // bean鐨勫悕绉帮紝榛樿涓洪瀛楁瘝灏忓啓鐨勬柟娉曞悕 public ThreadPoolTaskExecutor taskExecutor() { ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); -- Gitblit v1.8.0