[FIX] makeProfile fix

This commit is contained in:
Gravita 2021-05-10 13:52:12 +07:00
parent afe3dd543e
commit 7277aba7ee
4 changed files with 14 additions and 1 deletions

View file

@ -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

View file

@ -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");

View file

@ -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;
}

View file

@ -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<ServerInfoEntry> pingMinecraftServer(String hostname, int port) {
throw new UnsupportedOperationException("not implemented");
}
public static class ServerInfoEntry {
public final ClientProfile profile;
public PingServerReportRequest.PingServerReport lastReport;