forked from External/mage
Big refactoring (server)
I used Intellij IDEA to automatically refactor code to achive 3 goals. 1) get rid of anonymouse classes, and replace the with lamba to get more readeable and clean code (like in TableWaitingDialog). 2) make effectively final variables actually final to avoid inadvertent changes on it in further releases and keep objects as immutable, as possible. 3) Get rid of unused imports (most of the changes) in whole project classes.
This commit is contained in:
parent
076840df53
commit
46d369c8ed
31 changed files with 510 additions and 822 deletions
|
|
@ -49,14 +49,14 @@ import java.util.concurrent.TimeUnit;
|
|||
public class TournamentSession {
|
||||
protected final static Logger logger = Logger.getLogger(TournamentSession.class);
|
||||
|
||||
protected UUID userId;
|
||||
protected UUID playerId;
|
||||
protected UUID tableId;
|
||||
protected Tournament tournament;
|
||||
protected final UUID userId;
|
||||
protected final UUID playerId;
|
||||
protected final UUID tableId;
|
||||
protected final Tournament tournament;
|
||||
protected boolean killed = false;
|
||||
|
||||
private ScheduledFuture<?> futureTimeout;
|
||||
protected static ScheduledExecutorService timeoutExecutor = ThreadExecutor.getInstance().getTimeoutExecutor();
|
||||
protected static final ScheduledExecutorService timeoutExecutor = ThreadExecutor.getInstance().getTimeoutExecutor();
|
||||
|
||||
public TournamentSession(Tournament tournament, UUID userId, UUID tableId, UUID playerId) {
|
||||
this.userId = userId;
|
||||
|
|
@ -129,16 +129,13 @@ public class TournamentSession {
|
|||
cancelTimeout();
|
||||
if (seconds > 0) {
|
||||
futureTimeout = timeoutExecutor.schedule(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
try {
|
||||
TournamentManager.getInstance().timeout(tournament.getId(), userId);
|
||||
} catch (Exception e) {
|
||||
logger.fatal("TournamentSession error - userId " + userId + " tId " + tournament.getId(), e);
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
seconds, TimeUnit.SECONDS
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue