perf: 优化开机时候和采集异常触发的断线重连

main
huangfeng 6 months ago
parent 11731782f3
commit 3f7b3a0dc6

@ -90,9 +90,8 @@ public class IEDCollectService {
_webSocketServer.sendMessage(err, null); _webSocketServer.sendMessage(err, null);
} }
if (ex instanceof SocketException) { if (ex instanceof SocketException) {
NetErrorThread thread = new NetErrorThread(); NetErrorThread thread = new NetErrorThread(ied.getId());
thread.iedId = ied.getId(); thread.start();
thread.run();
} }
} finally { } finally {
iecClient.disconnect(); iecClient.disconnect();

@ -5,6 +5,10 @@ import com.xydl.cac.model.StaticVariable;
public class NetErrorThread extends Thread { public class NetErrorThread extends Thread {
public int iedId; public int iedId;
public NetErrorThread(Integer iedid) {
iedId = iedid;
}
@Override @Override
public void run() { public void run() {
IecClient iecClient = StaticVariable.realTimeClientMap.get(iedId); IecClient iecClient = StaticVariable.realTimeClientMap.get(iedId);

@ -38,6 +38,8 @@ public class RealTimeDataService {
try { try {
this.startCollect(ied); this.startCollect(ied);
} catch (Exception ignore) { } catch (Exception ignore) {
NetErrorThread thread = new NetErrorThread(ied.getId());
thread.start();
} }
} }
} }

Loading…
Cancel
Save