From c0b596275d583b0874e501f49a90e7a1dfd879e3 Mon Sep 17 00:00:00 2001 From: wuyouming666 <2265557248@qq.com> Date: 星期四, 09 五月 2024 09:37:48 +0800 Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/CanadaMes --- springboot-vue3/src/main/java/com/example/springboot/component/PlcServoManualone.java | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/springboot-vue3/src/main/java/com/example/springboot/component/PlcServoManualone.java b/springboot-vue3/src/main/java/com/example/springboot/component/PlcServoManualone.java index facf708..a7545da 100644 --- a/springboot-vue3/src/main/java/com/example/springboot/component/PlcServoManualone.java +++ b/springboot-vue3/src/main/java/com/example/springboot/component/PlcServoManualone.java @@ -2,6 +2,8 @@ import cn.hutool.json.JSONArray; import cn.hutool.json.JSONObject; +import lombok.extern.slf4j.Slf4j; + import com.google.common.primitives.Bytes; import org.apache.commons.io.FileUtils; @@ -9,7 +11,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; - +@Slf4j public class PlcServoManualone extends Thread { // 鐢ㄤ簬瀛樺偍搴旂敤绋嬪簭鐨勯厤缃俊鎭� @@ -230,9 +232,10 @@ ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("ServoManualone"); if (sendwServer != null) { for (WebSocketServer webserver : sendwServer) { - webserver.sendMessage(jsonObject.toString()); + - if (webserver != null) { + if (webserver != null&&webserver.session.isOpen()) { + webserver.sendMessage(jsonObject.toString()); List<String> messages = webserver.getMessages(); if (!messages.isEmpty()) { @@ -270,6 +273,8 @@ // 娓呯┖娑堟伅鍒楄〃 webserver.clearMessages(); } + }else{ + log.info("ServoManualone is closed"); } } } -- Gitblit v1.8.0