From 9d61a93077d22dec47760c294a8658f5a5223b67 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期三, 03 一月 2024 15:50:47 +0800
Subject: [PATCH] 优化数据库sql文件组织方式
---
src/main/java/com/genersoft/iot/vmp/conf/ThreadPoolTaskConfig.java | 19 ++++++++++++++++---
1 files changed, 16 insertions(+), 3 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 1dfd591..c7532e3 100644
--- a/src/main/java/com/genersoft/iot/vmp/conf/ThreadPoolTaskConfig.java
+++ b/src/main/java/com/genersoft/iot/vmp/conf/ThreadPoolTaskConfig.java
@@ -2,14 +2,22 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
+import org.springframework.core.annotation.Order;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.concurrent.ThreadPoolExecutor;
+/**
+ * ThreadPoolTask 閰嶇疆绫�
+ * @author lin
+ */
@Configuration
+@Order(1)
@EnableAsync(proxyTargetClass = true)
public class ThreadPoolTaskConfig {
+
+ public static final int cpuNum = Runtime.getRuntime().availableProcessors();
/**
* 榛樿鎯呭喌涓嬶紝鍦ㄥ垱寤轰簡绾跨▼姹犲悗锛岀嚎绋嬫睜涓殑绾跨▼鏁颁负0锛屽綋鏈変换鍔℃潵涔嬪悗锛屽氨浼氬垱寤轰竴涓嚎绋嬪幓鎵ц浠诲姟锛�
@@ -20,15 +28,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 +45,12 @@
/**
* 绾跨▼姹犲悕鍓嶇紑
*/
- private static final String threadNamePrefix = "wvp-sip-handle-";
+ private static final String threadNamePrefix = "wvp-";
+ /**
+ *
+ * @return
+ */
@Bean("taskExecutor") // bean鐨勫悕绉帮紝榛樿涓洪瀛楁瘝灏忓啓鐨勬柟娉曞悕
public ThreadPoolTaskExecutor taskExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
--
Gitblit v1.8.0