From 1116b5a1c3feb85959d9b0b03e1c14693271aa8a Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期五, 20 三月 2026 17:44:25 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/core/network/ZyStationConnectDriver.java | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/src/main/java/com/zy/core/network/ZyStationConnectDriver.java b/src/main/java/com/zy/core/network/ZyStationConnectDriver.java
index 2bc600c..9b16ece 100644
--- a/src/main/java/com/zy/core/network/ZyStationConnectDriver.java
+++ b/src/main/java/com/zy/core/network/ZyStationConnectDriver.java
@@ -9,7 +9,6 @@
import com.zy.core.network.api.ZyStationConnectApi;
import com.zy.core.network.entity.ZyStationStatusEntity;
import java.util.List;
-import com.zy.core.network.fake.ZyStationFakeConnect;
import com.zy.core.network.fake.ZyStationFakeSegConnect;
import com.zy.core.network.fake.ZyStationV4FakeSegConnect;
import com.zy.core.network.real.ZyStationRealConnect;
@@ -28,7 +27,6 @@
@Slf4j
public class ZyStationConnectDriver implements ThreadHandler {
- private static final ZyStationFakeConnect zyStationFakeConnect = new ZyStationFakeConnect();
private static final ZyStationFakeSegConnect zyStationFakeSegConnect = new ZyStationFakeSegConnect();
private static final ZyStationV4FakeSegConnect zyStationV4FakeSegConnect = new ZyStationV4FakeSegConnect();
@@ -38,6 +36,7 @@
private RedisUtil redisUtil;
private volatile ZyStationConnectApi zyStationConnectApi;
private volatile boolean closed = false;
+ private volatile boolean fakeConfigUnsupported = false;
private ScheduledExecutorService executor;
private final Object connectLock = new Object();
@@ -57,6 +56,9 @@
if (closed) {
return false;
}
+ if (fakeConfigUnsupported) {
+ return false;
+ }
if (connected && zyStationConnectApi != null) {
return true;
}
@@ -67,7 +69,8 @@
if (deviceConfig.getFake() == 0) {
if ("ZyStationV3Thread".equals(deviceConfig.getThreadImpl())) {
connectApi = new ZyStationV3RealConnect(deviceConfig, redisUtil);
- } else if ("ZyStationV4Thread".equals(deviceConfig.getThreadImpl())) {
+ } else if ("ZyStationV4Thread".equals(deviceConfig.getThreadImpl())
+ || "ZyStationV5Thread".equals(deviceConfig.getThreadImpl())) {
connectApi = new ZyStationV4RealConnect(deviceConfig, redisUtil);
} else {
connectApi = new ZyStationRealConnect(deviceConfig, redisUtil);
@@ -76,12 +79,16 @@
if ("ZyStationV3Thread".equals(deviceConfig.getThreadImpl())) {
zyStationFakeSegConnect.addFakeConnect(deviceConfig, redisUtil);
connectApi = zyStationFakeSegConnect;
- } else if ("ZyStationV4Thread".equals(deviceConfig.getThreadImpl())) {
+ } else if ("ZyStationV4Thread".equals(deviceConfig.getThreadImpl())
+ || "ZyStationV5Thread".equals(deviceConfig.getThreadImpl())) {
zyStationV4FakeSegConnect.addFakeConnect(deviceConfig, redisUtil);
connectApi = zyStationV4FakeSegConnect;
} else {
- zyStationFakeConnect.addFakeConnect(deviceConfig, redisUtil);
- connectApi = zyStationFakeConnect;
+ fakeConfigUnsupported = true;
+ zyStationConnectApi = null;
+ log.error("鏃х増杈撻�佺珯 fake 宸茬Щ闄わ紝deviceNo={}, threadImpl={}, 璇峰垏鎹㈠埌 ZyStationV3Thread銆乑yStationV4Thread 鎴� ZyStationV5Thread",
+ deviceConfig.getDeviceNo(), deviceConfig.getThreadImpl());
+ return false;
}
}
--
Gitblit v1.9.1