From 471d7b5bc4c8cf7ffeb258f208a66cca202d64de Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期一, 14 七月 2025 14:50:42 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/core/thread/impl/NyShuttleThread.java | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/src/main/java/com/zy/core/thread/impl/NyShuttleThread.java b/src/main/java/com/zy/core/thread/impl/NyShuttleThread.java
index b585b55..549f350 100644
--- a/src/main/java/com/zy/core/thread/impl/NyShuttleThread.java
+++ b/src/main/java/com/zy/core/thread/impl/NyShuttleThread.java
@@ -108,10 +108,20 @@
writer.flush();
// System.out.println("Sent message to server: " + JSON.toJSONString(httpCommand));
}catch (SocketException e) {
- this.socket = null;
e.printStackTrace();
+ closeSocket();
} catch (IOException e) {
e.printStackTrace();
+ }
+ }
+
+ private void closeSocket() {
+ try {
+ this.socket.close();
+ } catch (Exception e1) {
+
+ }finally {
+ this.socket = null;
}
}
@@ -200,6 +210,7 @@
}
} catch (Exception e) {
// e.printStackTrace();
+ closeSocket();
}
}
@@ -336,4 +347,8 @@
this.stopThread = true;
}
+ @Override
+ public Socket getSocket() {
+ return this.socket;
+ }
}
--
Gitblit v1.9.1