mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
Some changes to logging.
This commit is contained in:
parent
9ade5efde0
commit
4beb1ccad3
4 changed files with 29 additions and 15 deletions
|
|
@ -222,7 +222,7 @@ public class MageServerImpl implements MageServer {
|
|||
if (logger.isDebugEnabled()) {
|
||||
User user = UserManager.getInstance().getUser(userId);
|
||||
if (user != null) {
|
||||
logger.debug("join tourn. tableId: " + tableId + " " + user.getName());
|
||||
logger.debug("join tourn. tableId: " + tableId + " " + name);
|
||||
}
|
||||
}
|
||||
if (userId == null) {
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ public class TableManager {
|
|||
removeTable(tableId);
|
||||
|
||||
} else {
|
||||
logger.debug("TableManager.leaveTable leaveTable");
|
||||
logger.debug("TABLE leave - userId: " + userId + " tableId: " + tableId);
|
||||
tableController.leaveTable(userId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -203,9 +203,9 @@ public class TournamentController {
|
|||
}
|
||||
|
||||
private synchronized void startTournament() {
|
||||
for (final Entry<UUID, TournamentSession> entry: tournamentSessions.entrySet()) {
|
||||
if (!entry.getValue().init()) {
|
||||
logger.fatal("Unable to initialize client");
|
||||
for (final TournamentSession tournamentSession: tournamentSessions.values()) {
|
||||
if (!tournamentSession.init()) {
|
||||
logger.fatal("Unable to initialize client userId: " + tournamentSession.userId + " tournamentId " + tournament.getId());
|
||||
//TODO: generate client error message
|
||||
return;
|
||||
}
|
||||
|
|
@ -220,7 +220,6 @@ public class TournamentController {
|
|||
}
|
||||
for (final TournamentSession tournamentSession: tournamentSessions.values()) {
|
||||
tournamentSession.tournamentOver();
|
||||
tournamentSession.removeTournamentForUser();
|
||||
}
|
||||
this.tournamentSessions.clear();
|
||||
TableManager.getInstance().endTournament(tableId, tournament);
|
||||
|
|
@ -344,6 +343,9 @@ public class TournamentController {
|
|||
}
|
||||
tPlayer.setQuit(info);
|
||||
tournament.quit(playerId);
|
||||
if (tournamentSessions.containsKey(playerId)) {
|
||||
tournamentSessions.get(tPlayer.getPlayer().getId()).quit();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tournament.leave(playerId);
|
||||
|
|
|
|||
|
|
@ -157,13 +157,6 @@ public class TournamentSession {
|
|||
}
|
||||
}
|
||||
|
||||
public void removeTournamentForUser() {
|
||||
User user = UserManager.getInstance().getUser(userId);
|
||||
if (user != null) {
|
||||
user.removeTournament(playerId);
|
||||
}
|
||||
}
|
||||
|
||||
private TournamentView getTournamentView() {
|
||||
return new TournamentView(tournament);
|
||||
}
|
||||
|
|
@ -172,8 +165,27 @@ public class TournamentSession {
|
|||
return tournament.getId();
|
||||
}
|
||||
|
||||
void tournamentOver() {
|
||||
|
||||
public void tournamentOver() {
|
||||
cleanUp();
|
||||
removeTournamentForUser();
|
||||
}
|
||||
|
||||
public void quit() {
|
||||
cleanUp();
|
||||
removeTournamentForUser();
|
||||
}
|
||||
|
||||
private void cleanUp() {
|
||||
if (!futureTimeout.isDone()) {
|
||||
futureTimeout.cancel(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void removeTournamentForUser() {
|
||||
User user = UserManager.getInstance().getUser(userId);
|
||||
if (user != null) {
|
||||
user.removeTournament(playerId);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue