From 2799314298467be9ed68d9e19891e35cb3c3edad Mon Sep 17 00:00:00 2001
From: zhangnaisong <2434969829@qq.com>
Date: 星期四, 01 八月 2024 08:14:18 +0800
Subject: [PATCH] 电磁锁动作状态改为操控中...提交

---
 ard-work/src/main/java/com/ruoyi/alarm/config/AsyncConfiguration.java |   48 +++++++++++++++++++++++++-----------------------
 1 files changed, 25 insertions(+), 23 deletions(-)

diff --git a/ard-work/src/main/java/com/ruoyi/alarm/config/AsyncConfiguration.java b/ard-work/src/main/java/com/ruoyi/alarm/config/AsyncConfiguration.java
index 9512bbb..7ce10af 100644
--- a/ard-work/src/main/java/com/ruoyi/alarm/config/AsyncConfiguration.java
+++ b/ard-work/src/main/java/com/ruoyi/alarm/config/AsyncConfiguration.java
@@ -4,6 +4,7 @@
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.AsyncConfigurer;
 import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
 
@@ -18,8 +19,8 @@
  * @Version: 1.0
  **/
 @Configuration
-@EnableAsync(proxyTargetClass = true)
-public class AsyncConfiguration {
+@EnableAsync
+public class AsyncConfiguration{
     @Value("${ThreadPoolTask.corePoolSize}")
     Integer corePoolSize;
     @Value("${ThreadPoolTask.maxPoolSize}")
@@ -40,27 +41,6 @@
         executor.setQueueCapacity(queueCapacity);
         //绾跨▼鐨勫悕绉板墠缂�
         executor.setThreadNamePrefix("alarmExecutor-");
-        //绾跨▼娲昏穬鏃堕棿锛堢锛�
-        executor.setKeepAliveSeconds(keepAliveSeconds);
-        //绛夊緟鎵�鏈変换鍔$粨鏉熷悗鍐嶅叧闂嚎绋嬫睜
-        executor.setWaitForTasksToCompleteOnShutdown(true);
-        //璁剧疆鎷掔粷绛栫暐
-        executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
-        //鎵ц鍒濆鍖�
-        executor.initialize();
-        return executor;
-    }
-    @Bean("loginExecutor")
-    public Executor loginExecutor(){
-        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
-        //閰嶇疆鏍稿績绾跨▼鏁�
-        executor.setCorePoolSize(corePoolSize);
-        //閰嶇疆鏈�澶х嚎绋嬫暟
-        executor.setMaxPoolSize(maxPoolSize);
-        //閰嶇疆闃熷垪澶у皬
-        executor.setQueueCapacity(queueCapacity);
-        //绾跨▼鐨勫悕绉板墠缂�
-        executor.setThreadNamePrefix("loginExecutor-");
         //绾跨▼娲昏穬鏃堕棿锛堢锛�
         executor.setKeepAliveSeconds(keepAliveSeconds);
         //绛夊緟鎵�鏈変换鍔$粨鏉熷悗鍐嶅叧闂嚎绋嬫睜
@@ -92,4 +72,26 @@
         executor.initialize();
         return executor;
     }
+    @Bean("globalExecutor")
+    public Executor globalExecutor(){
+        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+        //閰嶇疆鏍稿績绾跨▼鏁�
+        executor.setCorePoolSize(10);
+        //閰嶇疆鏈�澶х嚎绋嬫暟
+        executor.setMaxPoolSize(15);
+        //閰嶇疆闃熷垪澶у皬
+        executor.setQueueCapacity(25);
+        //绾跨▼鐨勫悕绉板墠缂�
+        executor.setThreadNamePrefix("globalExecutor-");
+        //绾跨▼娲昏穬鏃堕棿锛堢锛�
+        executor.setKeepAliveSeconds(keepAliveSeconds);
+        //绛夊緟鎵�鏈変换鍔$粨鏉熷悗鍐嶅叧闂嚎绋嬫睜
+        executor.setWaitForTasksToCompleteOnShutdown(true);
+        //璁剧疆鎷掔粷绛栫暐
+        executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
+        //鎵ц鍒濆鍖�
+        executor.initialize();
+        return executor;
+    }
+
 }

--
Gitblit v1.9.3