From 71d499e1ad7d4e2f2886627f7a57e0fadf0bc235 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期三, 06 五月 2026 16:48:11 +0800
Subject: [PATCH] #dfs

---
 src/main/java/com/zy/core/ServerBootstrap.java |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/zy/core/ServerBootstrap.java b/src/main/java/com/zy/core/ServerBootstrap.java
index 68cc1a2..82d1ebd 100644
--- a/src/main/java/com/zy/core/ServerBootstrap.java
+++ b/src/main/java/com/zy/core/ServerBootstrap.java
@@ -7,6 +7,7 @@
 import com.zy.common.utils.RedisUtil;
 import com.zy.core.cache.MessageQueue;
 import com.zy.core.cache.SlaveConnection;
+import com.zy.core.enums.RedisKeyType;
 import com.zy.core.enums.SlaveType;
 import com.zy.core.thread.impl.*;
 
@@ -24,6 +25,8 @@
 @Component
 public class ServerBootstrap {
 
+    private static boolean initThread = false;
+
     @Autowired
     private MainProcess mainProcess;
     @Autowired
@@ -33,14 +36,28 @@
 
     @Async
     public void init() throws InterruptedException {
+        if (initThread) {
+            return;
+        }
         News.info("鏍稿績鎺у埗灞傚紑濮嬪垵濮嬪寲...............................................");
+        clearStartupRuntimeLocks();
         // 鍒濆鍖栨秷鎭槦鍒�
         initMq();
         // 鍒濆鍖栦笅浣嶆満绾跨▼
         initThread();
         // 寮�濮嬩富娴佺▼杩涚▼
         mainProcess.start();
+        initThread = true;
         News.info("鏍稿績鎺у埗灞傚凡鍚姩...............................................");
+    }
+
+    private void clearStartupRuntimeLocks() {
+        redisUtil.del(RedisKeyType.STATION_EXECUTE_COMMAND_LOCK.key);
+        java.util.Set<String> stationSendLockKeys = redisUtil.scanKeys(RedisKeyType.STATION_EXECUTE_COMMAND_LOCK.key + ":", 2048);
+        if (stationSendLockKeys != null && !stationSendLockKeys.isEmpty()) {
+            redisUtil.del(stationSendLockKeys.toArray(new String[0]));
+        }
+//        News.info("绯荤粺鍚姩鏃跺凡娓呯悊杈撻�佺珯鍛戒护鎵ц閿侊紝key={}", RedisKeyType.STATION_EXECUTE_COMMAND_LOCK.key);
     }
 
     private void initMq(){
@@ -135,8 +152,8 @@
                     thread = new ZyStationThread(deviceConfig, redisUtil);
                 } else if (deviceConfig.getThreadImpl().equals("ZyStationV3Thread")) {
                     thread = new ZyStationV3Thread(deviceConfig, redisUtil);
-                } else if (deviceConfig.getThreadImpl().equals("ZyStationV4Thread")) {
-                    thread = new ZyStationV4Thread(deviceConfig, redisUtil);
+                } else if (deviceConfig.getThreadImpl().equals("ZyStationV5Thread")) {
+                    thread = new ZyStationV5Thread(deviceConfig, redisUtil);
                 } else {
                     throw new CoolException("鏈煡鐨勭嚎绋嬪疄鐜�");
                 }

--
Gitblit v1.9.1