perf: 优化停止订阅处理

dev
huangfeng 8 months ago
parent 6211c75a93
commit c5e66d9e03

@ -119,7 +119,11 @@ public class IecClient implements ClientEventListener {
} catch (Exception ignore) { } catch (Exception ignore) {
} }
} }
log.info("61850停止订阅, ied=" + ied.getName() + ", ip=" + ied.getIp() + ", port=" + ied.getPort()); if (keep) {
log.warn("61850订阅已断开, ied=" + ied.getName() + ", ip=" + ied.getIp() + ", port=" + ied.getPort());
} else {
log.info("61850停止订阅, ied=" + ied.getName() + ", ip=" + ied.getIp() + ", port=" + ied.getPort());
}
} }
public List<FileInformation> listFile(String path) throws Exception { public List<FileInformation> listFile(String path) throws Exception {
@ -147,7 +151,6 @@ public class IecClient implements ClientEventListener {
if (keep) { if (keep) {
this.disableReporting(); this.disableReporting();
this.disconnect(); this.disconnect();
log.warn("61850订阅已断开, ied=" + ied.getName() + ", ip=" + ied.getIp() + ", port=" + ied.getPort());
while (retry > 0) { while (retry > 0) {
retry--; retry--;
try { try {

@ -16,10 +16,7 @@ import org.springframework.util.CollectionUtils;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy; import javax.annotation.PreDestroy;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.HashMap; import java.util.*;
import java.util.Iterator;
import java.util.List;
import java.util.Optional;
@Service @Service
@Slf4j @Slf4j
@ -104,9 +101,12 @@ public class RealTimeDataService {
@PreDestroy @PreDestroy
private void stop() { private void stop() {
log.info("关闭61850订阅服务."); log.info("关闭61850订阅服务.");
List<Integer> idList = new ArrayList<>();
Iterator<Integer> it = clientMap.keySet().iterator(); Iterator<Integer> it = clientMap.keySet().iterator();
while (it.hasNext()) { while (it.hasNext()) {
Integer iedId = it.next(); idList.add(it.next());
}
for (Integer iedId : idList) {
this.onlyStop(iedId); this.onlyStop(iedId);
} }
} }

Loading…
Cancel
Save