Added try-catches to schedulers to identify errors

This commit is contained in:
Treeku
2014-06-18 08:06:27 +01:00
parent b44ddd3b31
commit 97af15a747
20 changed files with 558 additions and 406 deletions
+13 -9
View File
@@ -79,19 +79,23 @@ public class ConnectionService implements INetworkDispatch {
scheduler.scheduleAtFixedRate(new Runnable() {
public void run() {
synchronized(core.getActiveConnectionsMap()) {
for(Client c : core.getActiveConnectionsMap().values()) {
if(c.getParent() != null) {
if ((System.currentTimeMillis() - c.getSession().getLastReadTime()) > 300000) {
try {
disconnect(c);
} catch (Exception e) {
System.err.println("ConnectionService:disconnect(): Error disconnecting client.");
e.printStackTrace();
try {
synchronized(core.getActiveConnectionsMap()) {
for(Client c : core.getActiveConnectionsMap().values()) {
if(c.getParent() != null) {
if ((System.currentTimeMillis() - c.getSession().getLastReadTime()) > 300000) {
try {
disconnect(c);
} catch (Exception e) {
System.err.println("ConnectionService:disconnect(): Error disconnecting client.");
e.printStackTrace();
}
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}