From 801d9da2e1b1b69a6c92d098ed59e698b4a15b08 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 9 Oct 2021 16:06:31 +0200 Subject: [PATCH] OpenJ9 Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/Node.java | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/de/steamwar/bungeecore/Node.java b/src/de/steamwar/bungeecore/Node.java index 465778c2..a9273a9b 100644 --- a/src/de/steamwar/bungeecore/Node.java +++ b/src/de/steamwar/bungeecore/Node.java @@ -32,8 +32,7 @@ import java.util.logging.Level; public abstract class Node { - private static final List JVM_ARGS = Arrays.asList("-Dlog4j.configurationFile=log4j2.xml", "-server", "-Xms128M", "-XX:+UseCompressedOops", "-XX:+TieredCompilation", "-XX:TargetSurvivorRatio=90", "-XX:SurvivorRatio=8", "-XX:MaxTenuringThreshold=15", "-XX:+UnlockExperimentalVMOptions", "-XX:+UseBiasedLocking", "-XX:UseSSE=3", "-XX:+UseCodeCacheFlushing", "-XX:+UseThreadPriorities", "-XX:+AggressiveOpts", "-XX:+ReduceSignalUsage", "-XX:+UseInterpreter", "-XX:+UseSharedSpaces", "-XX:AllocatePrefetchStyle=1", "-XX:+AlwaysCompileLoopMethods", "-XX:+UseConcMarkSweepGC", "-XX:+RewriteFrequentPairs", "-XX:+OptimizeStringConcat", "-XX:+CMSCleanOnEnter", "-XX:+UseInlineCaches"); - private static final List JVM8_ARGS = Arrays.asList("-XX:ThreadPriorityPolicy=42", "-XX:SharedReadOnlySize=30m", "-XX:+UseFastEmptyMethods", "-XX:+UseFastAccessorMethods"); + private static final List OPENJ9_ARGS = Arrays.asList("-Xsyslog:none", "-Xtrace:none", "-Xdisableexplicitgc", "-XX:+AlwaysPreTouch", "-XX:+CompactStrings"); private static final double MIN_FREE_MEM = 4.0 * 1024 * 1024; // 4 GiB private static final List nodes = new ArrayList<>(); @@ -74,21 +73,15 @@ public abstract class Node { public abstract String getName(); public abstract double getLoad(); - protected void constructServerstart(List cmd, String serverJar, String worldDir, String levelName, int port, String xmx, String... dParams) { - boolean jdk11 = serverJar.contains("1.15.2"); - - if(jdk11) - cmd.add("/usr/lib/jvm/java-11-openjdk-amd64/bin/java"); - else - cmd.add("java"); + protected void constructServerstart(File directory, List cmd, String serverJar, String worldDir, String levelName, int port, String xmx, String... dParams) { + cmd.add("/usr/lib/jvm/java-16-openj9-amd64/bin/java"); for(String param : dParams){ cmd.add("-D" + param); } cmd.add("-Xmx" + xmx); - cmd.addAll(JVM_ARGS); - if(!jdk11) - cmd.addAll(JVM8_ARGS); + cmd.add("-Xshareclasses:nonfatal,name=" + directory.getName()); + cmd.addAll(OPENJ9_ARGS); cmd.add("-jar"); cmd.add("/binarys/" + serverJar); cmd.add("--log-strip-color"); @@ -126,7 +119,7 @@ public abstract class Node { @Override public ProcessBuilder startServer(String serverJar, File directory, String worldDir, String levelName, int port, String xmx, String... dParams) { List cmd = new ArrayList<>(); - constructServerstart(cmd, serverJar, worldDir, levelName, port, xmx, dParams); + constructServerstart(directory, cmd, serverJar, worldDir, levelName, port, xmx, dParams); ProcessBuilder builder = new ProcessBuilder(cmd); builder.directory(directory); return builder; @@ -172,7 +165,7 @@ public abstract class Node { public RemoteNode(String remote) { this.remote = remote; - //Determin core count + //Determine core count Process process; try { process = new ProcessBuilder("ssh", remote, "nproc").start(); @@ -213,7 +206,7 @@ public abstract class Node { cmd.add("cd"); cmd.add(directory.getPath()); cmd.add(";"); - constructServerstart(cmd, serverJar, worldDir, levelName, port, xmx, dParams); + constructServerstart(directory, cmd, serverJar, worldDir, levelName, port, xmx, dParams); return new ProcessBuilder(cmd); }