Added error handling for TournamentSession

This commit is contained in:
magenoxx 2014-05-03 14:12:31 +05:30
parent c77c43a1b0
commit c8ea8e7260
2 changed files with 14 additions and 7 deletions

View file

@ -28,11 +28,6 @@
package mage.server.tournament;
import java.rmi.RemoteException;
import java.util.UUID;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import mage.cards.decks.Deck;
import mage.game.tournament.Tournament;
import mage.interfaces.callback.ClientCallback;
@ -42,6 +37,12 @@ import mage.server.util.ThreadExecutor;
import mage.view.TournamentView;
import org.apache.log4j.Logger;
import java.rmi.RemoteException;
import java.util.UUID;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
/**
*
* @author BetaSteward_at_googlemail.com
@ -115,7 +116,7 @@ public class TournamentSession {
}
protected void handleRemoteException(RemoteException ex) {
logger.fatal("TournamentSession error ", ex);
logger.fatal("TournamentSession error - userId " + userId + " tId " + tournament.getId(), ex);
TournamentManager.getInstance().kill(tournament.getId(), userId);
}
@ -137,7 +138,11 @@ public class TournamentSession {
new Runnable() {
@Override
public void run() {
TournamentManager.getInstance().timeout(tournament.getId(), userId);
try {
TournamentManager.getInstance().timeout(tournament.getId(), userId);
} catch (Exception e) {
logger.fatal("TournamentSession error - userId " + userId + " tId " + tournament.getId(), e);
}
}
},
seconds, TimeUnit.SECONDS

View file

@ -22,7 +22,9 @@ log4j.appender.logfile.layout.ConversionPattern=%-5p [%d{yyyy-MM-dd HH:mm [ss:SS
#diagnostic log for game core classes
log4j.category.mage.server.game = INFO, diagfile
log4j.category.mage.server.tournament = INFO, diagfile
log4j.additivity.mage.server.game = false
log4j.additivity.mage.server.tournament = false
log4j.appender.diagfile=org.apache.log4j.FileAppender
log4j.appender.diagfile.File=magediag.log
log4j.appender.diagfile.layout=org.apache.log4j.PatternLayout