From 550d94c4c3eb3f7cb88ad9455b890d340134626d Mon Sep 17 00:00:00 2001 From: Nicolas Znamenski Date: Sun, 22 Sep 2019 18:08:12 -0400 Subject: [PATCH 1/2] Changed the thread pool size to be part of the config. --- .../java/org/geysermc/connector/GeyserConnector.java | 10 +++++----- .../connector/configuration/GeyserConfiguration.java | 3 +++ connector/src/main/resources/config.yml | 3 +++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java index f7e252a3..0f2819f2 100644 --- a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java +++ b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java @@ -99,18 +99,15 @@ public class GeyserConnector implements Connector { long startupTime = System.currentTimeMillis(); // Metric - if(!(System.console() == null) && System.getProperty("os.name", "Windows 10").toLowerCase().contains("windows")) { + if (!(System.console() == null) && System.getProperty("os.name", "Windows 10").toLowerCase().contains("windows")) { AnsiConsole.systemInstall(); } instance = this; - this.generalThreadPool = Executors.newScheduledThreadPool(32); //TODO: Make configurable value + this.generalThreadPool = Executors.newScheduledThreadPool(32); this.logger = GeyserLogger.DEFAULT; - ConsoleCommandReader consoleReader = new ConsoleCommandReader(this); - consoleReader.startConsole(); - logger.info("******************************************"); logger.info(""); logger.info("Loading " + NAME + " vesion " + VERSION); @@ -126,6 +123,9 @@ public class GeyserConnector implements Connector { shutdown(); } + ConsoleCommandReader consoleReader = new ConsoleCommandReader(this); + consoleReader.startConsole(); + logger.setDebug(config.isDebugMode()); Toolbox.CACHED_PALLETE.array(); diff --git a/connector/src/main/java/org/geysermc/connector/configuration/GeyserConfiguration.java b/connector/src/main/java/org/geysermc/connector/configuration/GeyserConfiguration.java index d4013744..d90f2576 100644 --- a/connector/src/main/java/org/geysermc/connector/configuration/GeyserConfiguration.java +++ b/connector/src/main/java/org/geysermc/connector/configuration/GeyserConfiguration.java @@ -47,5 +47,8 @@ public class GeyserConfiguration { @JsonProperty("debug-mode") private boolean debugMode; + @JsonProperty("general-thread-pool") + private int generalThreadPool; + private MetricInfo metrics; } \ No newline at end of file diff --git a/connector/src/main/resources/config.yml b/connector/src/main/resources/config.yml index 8506b14c..d2dff626 100644 --- a/connector/src/main/resources/config.yml +++ b/connector/src/main/resources/config.yml @@ -46,6 +46,9 @@ max-players: 100 # If debug messages should be sent through console debug-mode: false +# Thread pool size +general-thread-pool: 32 + # bStats is a stat tracker that is entirely anonymous and tracks only basic information # about Geyser, such as how many people are online, how many servers are using Geyser, # what OS is being used, etc. You can learn more about bStats here: https://bstats.org/. From 1d4837f5e0ff6e6c3e3f85b06cfd1a83fbd0cb61 Mon Sep 17 00:00:00 2001 From: Nicolas Znamenski Date: Sun, 22 Sep 2019 18:15:27 -0400 Subject: [PATCH 2/2] Finished moving thread pool size to config --- .../src/main/java/org/geysermc/connector/GeyserConnector.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java index 0f2819f2..6cede858 100644 --- a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java +++ b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java @@ -105,7 +105,6 @@ public class GeyserConnector implements Connector { instance = this; - this.generalThreadPool = Executors.newScheduledThreadPool(32); this.logger = GeyserLogger.DEFAULT; logger.info("******************************************"); @@ -123,6 +122,7 @@ public class GeyserConnector implements Connector { shutdown(); } + this.generalThreadPool = Executors.newScheduledThreadPool(config.getGeneralThreadPool()); ConsoleCommandReader consoleReader = new ConsoleCommandReader(this); consoleReader.startConsole();