|
@@ -68,9 +68,7 @@ public class actionSocket {
|
|
|
actionSocket.log.info("new connection, sessionId-{},Host-{}", session.id(), headers.get("Host"));
|
|
|
}
|
|
|
|
|
|
- @OnClose
|
|
|
- public void onClose(Session session) throws IOException, InterruptedException {
|
|
|
- actionSocket.log.info("one connection closed");
|
|
|
+ public void handleSessionMap(Session session) {
|
|
|
actionSocket.socketSessionBizMap.keySet().stream().forEach(
|
|
|
key -> {
|
|
|
if (key.contains(session.id().toString())) {
|
|
@@ -82,18 +80,17 @@ public class actionSocket {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @OnClose
|
|
|
+ public void onClose(Session session) throws IOException, InterruptedException {
|
|
|
+ actionSocket.log.info("one connection closed");
|
|
|
+ handleSessionMap(session);
|
|
|
+ }
|
|
|
+
|
|
|
@OnError
|
|
|
public void onError(Session session, Throwable throwable) throws InterruptedException {
|
|
|
throwable.printStackTrace();
|
|
|
- actionSocket.socketSessionBizMap.keySet().stream().forEach(
|
|
|
- key -> {
|
|
|
- if (key.contains(session.id().toString())) {
|
|
|
- actionSocket.socketSessionBizMap.get(key).interrupt();
|
|
|
- actionSocket.socketSessionBizMap.remove(key);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- );
|
|
|
+ handleSessionMap(session);
|
|
|
}
|
|
|
|
|
|
@OnMessage
|
|
@@ -166,6 +163,8 @@ public class actionSocket {
|
|
|
String msg = paramContext.get("msg");
|
|
|
Session session = paramContext1.get("session");
|
|
|
session.sendText(msg.toString());
|
|
|
+ //返回过后清除查询session,否则会不能查询
|
|
|
+ handleSessionMap(session);
|
|
|
|
|
|
}
|
|
|
|