perf: 使用异步线程来重连61850

main
huangfeng 6 months ago
parent 94277eaebb
commit ef38aa2675

@ -15,6 +15,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.CollectionUtils;
import java.net.SocketException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@ -88,7 +89,11 @@ public class IEDCollectService {
StaticVariable.doneWarnMap.put(key, "1");
_webSocketServer.sendMessage(err, null);
}
RealTimeDataService.onErrorCheck(ied.getId());
if (ex instanceof SocketException) {
NetErrorThread thread = new NetErrorThread();
thread.iedId = ied.getId();
thread.run();
}
} finally {
iecClient.disconnect();
}

@ -0,0 +1,15 @@
package com.xydl.cac.iec;
import com.xydl.cac.model.StaticVariable;
public class NetErrorThread extends Thread {
public int iedId;
@Override
public void run() {
IecClient iecClient = StaticVariable.realTimeClientMap.get(iedId);
if (iecClient != null) {
iecClient.associationClosed(null);
}
}
}

@ -66,13 +66,6 @@ public class RealTimeDataService {
}
}
public static void onErrorCheck(Integer iedId) {
IecClient iecClient = StaticVariable.realTimeClientMap.get(iedId);
if (iecClient != null) {
iecClient.associationClosed(null);
}
}
public void stopCollect(Integer iedId) {
IecClient iecClient = StaticVariable.realTimeClientMap.get(iedId);
if (iecClient != null) {

Loading…
Cancel
Save