[FIX] Исправлена ошибка некорректного завершения работы

This commit is contained in:
Gravit 2019-04-23 11:42:09 +07:00
parent 3a69e622ec
commit 50873253b0
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
2 changed files with 11 additions and 1 deletions

View file

@ -8,6 +8,7 @@
import ru.gravit.launcher.gui.RuntimeProvider; import ru.gravit.launcher.gui.RuntimeProvider;
import ru.gravit.launcher.managers.ClientGsonManager; import ru.gravit.launcher.managers.ClientGsonManager;
import ru.gravit.launcher.request.Request; import ru.gravit.launcher.request.Request;
import ru.gravit.launcher.request.websockets.ClientWebSocketService;
import ru.gravit.launcher.request.websockets.StandartClientWebSocketService; import ru.gravit.launcher.request.websockets.StandartClientWebSocketService;
import ru.gravit.utils.helper.CommonHelper; import ru.gravit.utils.helper.CommonHelper;
import ru.gravit.utils.helper.EnvHelper; import ru.gravit.utils.helper.EnvHelper;
@ -38,6 +39,9 @@ public static void main(String... args) throws Throwable {
} }
long endTime = System.currentTimeMillis(); long endTime = System.currentTimeMillis();
LogHelper.debug("Launcher started in %dms", endTime - startTime); LogHelper.debug("Launcher started in %dms", endTime - startTime);
//Request.service.close();
//FunctionalBridge.close();
System.exit(0);
} }
public static void initGson() { public static void initGson() {

View file

@ -16,11 +16,12 @@
import java.nio.file.Path; import java.nio.file.Path;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
public class FunctionalBridge { public class FunctionalBridge {
@LauncherAPI @LauncherAPI
public static ScheduledExecutorService threadPool = Executors.newScheduledThreadPool(4); public static ScheduledExecutorService threadPool = Executors.newScheduledThreadPool(0);
@LauncherAPI @LauncherAPI
public static OshiHWIDProvider hwidProvider = new OshiHWIDProvider(); public static OshiHWIDProvider hwidProvider = new OshiHWIDProvider();
@LauncherAPI @LauncherAPI
@ -84,6 +85,11 @@ public static void registerUserSettings(String typename, Class<? extends UserSet
{ {
UserSettings.providers.registerProvider(typename, clazz); UserSettings.providers.registerProvider(typename, clazz);
} }
@LauncherAPI
public static void close() throws Exception
{
threadPool.awaitTermination(2, TimeUnit.SECONDS);
}
@LauncherAPI @LauncherAPI
public static void setAuthParams(AuthRequestEvent event) { public static void setAuthParams(AuthRequestEvent event) {