Pattern fix.

This commit is contained in:
zaxar163 2019-01-02 18:04:52 +04:00 committed by Gravit
parent f56c26ad2b
commit c8b4500f1d

View file

@ -9,7 +9,7 @@
public class SessionManager implements NeedGarbageCollection { public class SessionManager implements NeedGarbageCollection {
public static final long SESSION_TIMEOUT = 10 * 60 * 1000; // 10 минут public static final long SESSION_TIMEOUT = 10 * 60 * 1000; // 10 минут
public static final boolean GARBAGE_SERVER = Boolean.parseBoolean(System.getProperty("launcher.garbage.sessions", "false")); public static final boolean GARBAGE_SERVER = Boolean.parseBoolean(System.getProperty("launcher.garbageSessionsServer", "false"));
private HashSet<Client> clientSet = new HashSet<>(128); private HashSet<Client> clientSet = new HashSet<>(128);
@ -21,7 +21,7 @@ public boolean addClient(Client client) {
@Override @Override
public void garbageCollection() { public void garbageCollection() {
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
clientSet.removeIf(c -> (c.timestamp + SESSION_TIMEOUT < time) && (c.type == Client.Type.USER) && GARBAGE_SERVER); clientSet.removeIf(c -> (c.timestamp + SESSION_TIMEOUT < time) && ((c.type == Client.Type.USER) || ((c.type == Client.Type.SERVER) && GARBAGE_SERVER)));
} }