perf: 优化关机等待时间处理

haikang
huangfeng 8 months ago
parent 00166e3a04
commit 7bc95e6e6a

@ -173,14 +173,14 @@ public class IecClient implements ClientEventListener {
retry--; retry--;
try { try {
if (retry >= 5) { if (retry >= 5) {
Thread.sleep(10 * 1000); StaticVariable.wait(10);
this.reconnect(); this.reconnect();
} else if (retry == 4) { } else if (retry == 4) {
log.warn("61850订阅断线重连已失败5次, ied=" + ied.getName() + ", ip=" + ied.getIp() + ", port=" + ied.getPort()); log.warn("61850订阅断线重连已失败5次, ied=" + ied.getName() + ", ip=" + ied.getIp() + ", port=" + ied.getPort());
Thread.sleep(60 * 1000); StaticVariable.wait(60);
this.reconnect(); this.reconnect();
} else if (retry >= 1) { } else if (retry >= 1) {
Thread.sleep(60 * 1000); StaticVariable.wait(60);
this.reconnect(); this.reconnect();
} else { } else {
String err = "61850订阅断线重连已失败多次不再重连. ied=" + ied.getName() + ", ip=" + ied.getIp() + ", port=" + ied.getPort(); String err = "61850订阅断线重连已失败多次不再重连. ied=" + ied.getName() + ", ip=" + ied.getIp() + ", port=" + ied.getPort();

@ -26,4 +26,12 @@ public class StaticVariable {
public static List<Zsb> zsb_Cache = null; public static List<Zsb> zsb_Cache = null;
public static ConcurrentHashMap<Integer, WarnRule> rule_Cache = new ConcurrentHashMap<>(); public static ConcurrentHashMap<Integer, WarnRule> rule_Cache = new ConcurrentHashMap<>();
public static void wait(int seconds) throws InterruptedException {
for (int i = 0; i < seconds; i++) {
if (shutdown == 1) {
break;
}
Thread.sleep(1000);
}
}
} }

Loading…
Cancel
Save