From 225ff843c424b13b71226483f1f360b1af679c64 Mon Sep 17 00:00:00 2001 From: zaxar163 Date: Fri, 25 Jan 2019 11:57:56 +0300 Subject: [PATCH] =?UTF-8?q?[FIX]=20=D0=92=D1=8B=D0=BD=D0=B5=D1=81=20Timer?= =?UTF-8?q?=20=D0=B2=20LaunchServer=20=D0=B8=20Updater,=20=D0=B2=D0=B5?= =?UTF-8?q?=D0=B4=D1=8C=20=D0=BC=D0=BE=D0=B4=D1=83=D0=BB=D0=B8=20=D1=82?= =?UTF-8?q?=D0=BE=D0=B6=D0=B5=20=D0=BC=D0=BE=D0=B3=D1=83=D1=82=20=D0=B5?= =?UTF-8?q?=D0=B3=D0=BE=20=D0=B8=D1=81=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D1=82=D1=8C.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/ru/gravit/launchserver/LaunchServer.java | 3 ++- .../src/main/java/ru/gravit/launchserver/Updater.java | 5 +---- 2 files changed, 3 insertions(+), 5 deletions(-) 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