mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-22 16:41:46 +03:00
Сборка мусора в CachedAuthHandler
This commit is contained in:
parent
2658c8a4ca
commit
4bdf6a2cbf
1 changed files with 10 additions and 2 deletions
|
@ -7,13 +7,17 @@
|
|||
import java.util.UUID;
|
||||
|
||||
import ru.gravit.launcher.LauncherAPI;
|
||||
import ru.gravit.launcher.NeedGarbageCollection;
|
||||
import ru.gravit.launcher.managers.GarbageManager;
|
||||
import ru.gravit.launcher.serialize.config.entry.BooleanConfigEntry;
|
||||
import ru.gravit.launcher.serialize.config.entry.StringConfigEntry;
|
||||
import ru.gravit.utils.helper.CommonHelper;
|
||||
import ru.gravit.utils.helper.SecurityHelper;
|
||||
import ru.gravit.utils.helper.VerifyHelper;
|
||||
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
||||
import ru.gravit.launchserver.auth.provider.AuthProviderResult;
|
||||
|
||||
public abstract class CachedAuthHandler extends AuthHandler {
|
||||
public abstract class CachedAuthHandler extends AuthHandler implements NeedGarbageCollection {
|
||||
public static final class Entry {
|
||||
@LauncherAPI
|
||||
public final UUID uuid;
|
||||
|
@ -36,6 +40,7 @@ public Entry(UUID uuid, String username, String accessToken, String serverID) {
|
|||
@LauncherAPI
|
||||
protected CachedAuthHandler(BlockConfigEntry block) {
|
||||
super(block);
|
||||
if(block.hasEntry("garbage")) if(block.getEntryValue("garbage", BooleanConfigEntry.class)) GarbageManager.registerNeedGC(this);
|
||||
}
|
||||
|
||||
@LauncherAPI
|
||||
|
@ -107,7 +112,10 @@ public synchronized boolean joinServer(String username, String accessToken, Stri
|
|||
entry.serverID = serverID;
|
||||
return true;
|
||||
}
|
||||
|
||||
public synchronized void garbageCollection()
|
||||
{
|
||||
entryCache.clear();
|
||||
}
|
||||
@LauncherAPI
|
||||
protected abstract boolean updateAuth(UUID uuid, String username, String accessToken) throws IOException;
|
||||
|
||||
|
|
Loading…
Reference in a new issue