diff --git a/src/main/java/com/xydl/cac/iec/IecClient.java b/src/main/java/com/xydl/cac/iec/IecClient.java index 7985dfc..5b5a653 100644 --- a/src/main/java/com/xydl/cac/iec/IecClient.java +++ b/src/main/java/com/xydl/cac/iec/IecClient.java @@ -3,6 +3,7 @@ package com.xydl.cac.iec; import com.beanit.iec61850bean.*; import com.xydl.cac.entity.IcdIed; import com.xydl.cac.entity.constants.Constants; +import com.xydl.cac.model.StaticVariable; import com.xydl.cac.socket.WebSocketServer; import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.IOUtils; @@ -82,6 +83,9 @@ public class IecClient implements ClientEventListener { } private void reconnect() throws Exception { + if (StaticVariable.shutdown == 1) { + return; + } clientAssociation = clientSap.associate(InetAddress.getByName(ied.getIp()), ied.getPort(), null, this); clientAssociation.setServerModel(serverModel); log.info("61850订阅断线重连成功, ied=" + ied.getName() + ", ip=" + ied.getIp() + ", port=" + ied.getPort()); @@ -165,7 +169,7 @@ public class IecClient implements ClientEventListener { if (keep) { this.disableReporting(); this.disconnect(); - while (retry > 0) { + while (retry > 0 && StaticVariable.shutdown == 0) { retry--; try { if (retry >= 5) { diff --git a/src/main/java/com/xydl/cac/iec/RealTimeDataService.java b/src/main/java/com/xydl/cac/iec/RealTimeDataService.java index d1c2f1a..65d5378 100644 --- a/src/main/java/com/xydl/cac/iec/RealTimeDataService.java +++ b/src/main/java/com/xydl/cac/iec/RealTimeDataService.java @@ -102,6 +102,7 @@ public class RealTimeDataService { @PreDestroy private void stop() { log.info("关闭61850订阅服务."); + StaticVariable.shutdown = 1; List idList = new ArrayList<>(); Iterator it = StaticVariable.realTimeClientMap.keySet().iterator(); while (it.hasNext()) { diff --git a/src/main/java/com/xydl/cac/model/StaticVariable.java b/src/main/java/com/xydl/cac/model/StaticVariable.java index e48abb8..7c45c20 100644 --- a/src/main/java/com/xydl/cac/model/StaticVariable.java +++ b/src/main/java/com/xydl/cac/model/StaticVariable.java @@ -18,6 +18,7 @@ public class StaticVariable { public static HashMap paramRelationMap = new HashMap<>(); public static HashMap doneWarnMap = new HashMap<>(); public static HashMap realTimeClientMap = new HashMap<>(); + public static int shutdown = 0; public static HashMap unit_Cache = new HashMap<>(); public static List modevType_Cache = null; diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 5a85f6d..ef5c1d6 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -30,6 +30,9 @@ spring: max-file-size: 100MB max-request-size: 100MB task: + execution: + pool: + core-size: 10 scheduling: pool: size: 10 diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index e9dc10c..b905bd9 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -30,6 +30,9 @@ spring: max-file-size: 100MB max-request-size: 100MB task: + execution: + pool: + core-size: 10 scheduling: pool: size: 10