mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 03:22:00 -08:00
* Added try catch block for user expired handling.
This commit is contained in:
parent
b6bc7c6a51
commit
0120808ef8
2 changed files with 37 additions and 29 deletions
|
|
@ -66,9 +66,10 @@ public class ChatSession {
|
|||
}
|
||||
|
||||
synchronized public void kill(UUID userId, DisconnectReason reason) {
|
||||
try {
|
||||
if (userId != null && clients.containsKey(userId)) {
|
||||
String userName = clients.get(userId);
|
||||
logger.debug(userName + " leaves chat: " + chatId);
|
||||
logger.debug((userName == null ? "[null]" :userName) + " leaves chat: " + (chatId == null?"[null]":chatId));
|
||||
clients.remove(userId);
|
||||
String message = null;
|
||||
switch (reason) {
|
||||
|
|
@ -86,6 +87,9 @@ public class ChatSession {
|
|||
logger.debug(userName + " left chat with reason: " + message + " " + chatId);
|
||||
}
|
||||
}
|
||||
} catch(Exception ex) {
|
||||
logger.fatal(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean broadcastInfoToUser(User toUser, String message) {
|
||||
|
|
|
|||
|
|
@ -155,6 +155,7 @@ public class UserManager {
|
|||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
logger.debug("checkExpired - start");
|
||||
Calendar expired = Calendar.getInstance();
|
||||
expired.add(Calendar.MINUTE, -3);
|
||||
|
|
@ -168,6 +169,9 @@ public class UserManager {
|
|||
}
|
||||
}
|
||||
logger.debug("checkExpired - end");
|
||||
} catch (Exception ex) {
|
||||
handleException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue