From 7277aba7ee73de05c52f91b7d91600aa46a6f6a6 Mon Sep 17 00:00:00 2001 From: Gravita Date: Mon, 10 May 2021 13:52:12 +0700 Subject: [PATCH] [FIX] makeProfile fix --- .../src/main/java/pro/gravit/launchserver/LaunchServer.java | 6 ++++++ .../launchserver/command/hash/SaveProfilesCommand.java | 2 +- .../pro/gravit/launchserver/config/LaunchServerConfig.java | 2 ++ .../gravit/launchserver/manangers/PingServerManager.java | 5 +++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServer.java b/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServer.java index b8877b9f..e3e2d9af 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServer.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServer.java @@ -39,6 +39,8 @@ import java.security.interfaces.ECPublicKey; import java.util.*; import java.util.Map.Entry; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.atomic.AtomicBoolean; import java.util.stream.Stream; @@ -116,7 +118,9 @@ public final class LaunchServer implements Runnable, AutoCloseable, Reconfigurab // Server public final CommandHandler commandHandler; public final NettyServerSocketHandler nettyServerSocketHandler; + @Deprecated public final Timer taskPool; + public final ScheduledExecutorService service; public final AtomicBoolean started = new AtomicBoolean(false); public final LauncherModuleLoader launcherModuleLoader; public LaunchServerConfig config; @@ -139,6 +143,7 @@ public LaunchServer(LaunchServerDirectories directories, LaunchServerEnv env, La this.commandHandler = commandHandler; this.runtime = runtimeConfig; this.certificateManager = certificateManager; + this.service = Executors.newScheduledThreadPool(config.netty.performance.schedulerThread); taskPool = new Timer("Timered task worker thread", true); launcherLibraries = directories.launcherLibrariesDir; launcherLibrariesCompile = directories.launcherLibrariesCompileDir; @@ -286,6 +291,7 @@ public void buildLauncherBinaries() throws IOException { } public void close() throws Exception { + service.shutdownNow(); logger.info("Close server socket"); nettyServerSocketHandler.close(); // Close handlers & providers diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/command/hash/SaveProfilesCommand.java b/LaunchServer/src/main/java/pro/gravit/launchserver/command/hash/SaveProfilesCommand.java index a2313d15..26f4c017 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/command/hash/SaveProfilesCommand.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/command/hash/SaveProfilesCommand.java @@ -48,7 +48,7 @@ public static ClientProfile makeProfile(ClientProfile.Version version, String ti jvmArgs.add("-XX:+DisableAttachMechanism"); // Official Mojang launcher java arguments jvmArgs.add("-XX:+UseG1GC"); - jvmArgs.add("XX:+UnlockExperimentalVMOptions"); + jvmArgs.add("-XX:+UnlockExperimentalVMOptions"); jvmArgs.add("-XX:G1NewSizePercent=20"); jvmArgs.add("-XX:MaxGCPauseMillis=50"); jvmArgs.add("-XX:G1HeapRegionSize=32M"); diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java b/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java index d8ff08dc..abe277cc 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java @@ -90,6 +90,7 @@ public static LaunchServerConfig getDefault(LaunchServer.LaunchServerEnv env) { } // such as on ARM newConfig.netty.performance.bossThread = 2; newConfig.netty.performance.workerThread = 8; + newConfig.netty.performance.schedulerThread = 2; newConfig.launcher = new LauncherConf(); newConfig.launcher.guardType = "no"; @@ -323,6 +324,7 @@ public static class NettyPerformanceConfig { public boolean usingEpoll; public int bossThread; public int workerThread; + public int schedulerThread; public long sessionLifetimeMs = 24 * 60 * 60 * 1000; public int maxWebSocketRequestBytes = 1024 * 1024; } diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/PingServerManager.java b/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/PingServerManager.java index 7a56985f..cc9ace7e 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/PingServerManager.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/PingServerManager.java @@ -6,6 +6,7 @@ import java.util.HashMap; import java.util.Map; +import java.util.concurrent.CompletableFuture; public class PingServerManager { public static final long REPORT_EXPIRED_TIME = 20 * 1000; @@ -38,6 +39,10 @@ public boolean updateServer(String name, PingServerReportRequest.PingServerRepor } } + public CompletableFuture pingMinecraftServer(String hostname, int port) { + throw new UnsupportedOperationException("not implemented"); + } + public static class ServerInfoEntry { public final ClientProfile profile; public PingServerReportRequest.PingServerReport lastReport;