|
|
@@ -92,7 +92,11 @@ public class WebSocket {
|
|
|
mmoSingleMessage.setMessageType(6);
|
|
|
mmoSingleMessage.setMessage("您已在其他地方登录");
|
|
|
webSocket.sendMessageTo(JSON.toJSONString(mmoSingleMessage), userId);
|
|
|
- webSocket.getSession().close();
|
|
|
+ try {
|
|
|
+ webSocket.getSession().close();
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("close session error", e);
|
|
|
+ }
|
|
|
}
|
|
|
// 获取上次登录的信息
|
|
|
MetaMMOLoginInfo metaMMOLoginInfo = metaMMOLoginInfoRepo.findLastByUserId(Long.parseLong(userId));
|
|
|
@@ -141,7 +145,7 @@ public class WebSocket {
|
|
|
metaMMOLoginInfoRepo.save(newMetaMMOLoginInfo);
|
|
|
} catch (Exception e) {
|
|
|
String errMsg = String.format("[%S]上线的时候发生了错误,错误信息[%S]", userId, e.getMessage());
|
|
|
- log.info(errMsg);
|
|
|
+ log.error(errMsg, e);
|
|
|
throw new BusinessException(errMsg);
|
|
|
}
|
|
|
}
|
|
|
@@ -361,7 +365,7 @@ public class WebSocket {
|
|
|
try {
|
|
|
webSocket.session.getBasicRemote().sendText(message);
|
|
|
} catch (IOException e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
+ log.error("sendMessageTo error", e);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
@@ -381,7 +385,7 @@ public class WebSocket {
|
|
|
try {
|
|
|
webSocket.session.getBasicRemote().sendText(message);
|
|
|
} catch (IOException e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
+ log.error("sendMessageAllOther error", e);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
@@ -398,7 +402,7 @@ public class WebSocket {
|
|
|
try {
|
|
|
webSocket.session.getBasicRemote().sendText(message);
|
|
|
} catch (IOException e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
+ log.error("sendMessageAll error", e);
|
|
|
}
|
|
|
});
|
|
|
}
|