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:
vraskulin 2017-01-09 19:47:03 +03:00
parent 076840df53
commit 46d369c8ed
31 changed files with 510 additions and 822 deletions

View file

@ -52,14 +52,14 @@ public class DraftSession {
protected final static Logger logger = Logger.getLogger(DraftSession.class);
protected UUID userId;
protected UUID playerId;
protected Draft draft;
protected final UUID userId;
protected final UUID playerId;
protected final Draft draft;
protected boolean killed = false;
protected UUID markedCard;
private ScheduledFuture<?> futureTimeout;
protected static ScheduledExecutorService timeoutExecutor = ThreadExecutor.getInstance().getTimeoutExecutor();
protected static final ScheduledExecutorService timeoutExecutor = ThreadExecutor.getInstance().getTimeoutExecutor();
public DraftSession(Draft draft, UUID userId, UUID playerId) {
this.userId = userId;
@ -125,12 +125,7 @@ public class DraftSession {
cancelTimeout();
if (seconds > 0) {
futureTimeout = timeoutExecutor.schedule(
new Runnable() {
@Override
public void run() {
DraftManager.getInstance().timeout(draft.getId(), userId);
}
},
() -> DraftManager.getInstance().timeout(draft.getId(), userId),
seconds, TimeUnit.SECONDS
);
}