diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java b/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java index f1552b8d..0072fa9d 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java @@ -287,9 +287,9 @@ public static void main(String... args) throws Throwable { // Updates and profiles private volatile List profilesList; - public volatile Map> updatesDirMap; + public final Timer taskPool; public final Updater updater; public static Gson gson; @@ -297,6 +297,7 @@ public static void main(String... args) throws Throwable { public LaunchServer(Path dir, String[] args) throws IOException, InvalidKeySpecException { this.dir = dir; + taskPool = new Timer("Timered task worker thread", true); launcherLibraries = dir.resolve("launcher-libraries"); if (!Files.isDirectory(launcherLibraries)) { Files.deleteIfExists(launcherLibraries); diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/Updater.java b/LaunchServer/src/main/java/ru/gravit/launchserver/Updater.java index 7136de39..1e98784e 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/Updater.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/Updater.java @@ -6,7 +6,6 @@ import java.time.format.DateTimeFormatter; import java.util.Date; import java.util.Locale; -import java.util.Timer; import java.util.TimerTask; import java.util.concurrent.atomic.AtomicReference; import java.util.regex.Matcher; @@ -25,12 +24,10 @@ public class Updater extends TimerTask { private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy.MM.dd HH:mm:ss", Locale.US); private static final long period = 1000*3600; private static final Version VERSION = Launcher.getVersion(); - private final Timer taskPool; private final GHRepository gravitLauncher; private Version parent = VERSION; public Updater(LaunchServer srv) { - this.taskPool = new Timer("Updater thread", true); GHRepository gravitLauncherTmp = null; try { @@ -40,7 +37,7 @@ public Updater(LaunchServer srv) { } this.gravitLauncher = gravitLauncherTmp; run(); - if (srv.config.updatesNotify) taskPool.schedule(this, new Date(System.currentTimeMillis()+period), period); + if (srv.config.updatesNotify) srv.taskPool.schedule(this, new Date(System.currentTimeMillis()+period), period); } @Override