[FEATURE] Возможность использовать в runtime планировщик задач

This commit is contained in:
Gravit 2019-04-20 02:27:06 +07:00
parent 514e8e3535
commit b5cdb0c244

View file

@ -1,6 +1,5 @@
package ru.gravit.launcher.client; package ru.gravit.launcher.client;
import javafx.concurrent.Task;
import ru.gravit.launcher.HWID; import ru.gravit.launcher.HWID;
import ru.gravit.launcher.LauncherAPI; import ru.gravit.launcher.LauncherAPI;
import ru.gravit.launcher.events.request.AuthRequestEvent; import ru.gravit.launcher.events.request.AuthRequestEvent;
@ -15,15 +14,13 @@
import ru.gravit.launcher.serialize.signed.SignedObjectHolder; import ru.gravit.launcher.serialize.signed.SignedObjectHolder;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
public class FunctionalBridge { public class FunctionalBridge {
@LauncherAPI @LauncherAPI
public static LauncherSettings settings; public static ScheduledExecutorService threadPool = Executors.newScheduledThreadPool(4);
@LauncherAPI
public static ExecutorService worker = Executors.newWorkStealingPool();
@LauncherAPI @LauncherAPI
public static OshiHWIDProvider hwidProvider = new OshiHWIDProvider(); public static OshiHWIDProvider hwidProvider = new OshiHWIDProvider();
@LauncherAPI @LauncherAPI
@ -48,8 +45,8 @@ public static void makeJsonRequest(RequestInterface request, Runnable callback)
} }
@LauncherAPI @LauncherAPI
public static void startTask(@SuppressWarnings("rawtypes") Task task) { public static void startTask(Runnable task) {
worker.execute(task); threadPool.execute(task);
} }
@LauncherAPI @LauncherAPI