From c1ba6a47ba0fa5a5c8f54f7951f82e3f2140ca0a Mon Sep 17 00:00:00 2001 From: Fuzzlemann Date: Sat, 29 Jul 2017 11:47:40 +0200 Subject: [PATCH] Add a multithread executor --- .../java/com/djrapitops/plan/ui/webserver/WebServer.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Plan/src/main/java/com/djrapitops/plan/ui/webserver/WebServer.java b/Plan/src/main/java/com/djrapitops/plan/ui/webserver/WebServer.java index a1e689f75..4dcde682c 100644 --- a/Plan/src/main/java/com/djrapitops/plan/ui/webserver/WebServer.java +++ b/Plan/src/main/java/com/djrapitops/plan/ui/webserver/WebServer.java @@ -21,7 +21,9 @@ import java.security.*; import java.security.cert.Certificate; import java.security.cert.CertificateException; import java.util.UUID; -import java.util.concurrent.Executors; +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; /** * @author Rsl1122 @@ -57,6 +59,7 @@ public class WebServer { if (enabled) { return; } + Log.info(Phrase.WEBSERVER_INIT.toString()); try { String keyStorePath = Settings.WEBSERVER_CERTIFICATE_PATH.toString(); @@ -139,10 +142,12 @@ public class WebServer { } } }); + if (startSuccessful) { context.setAuthenticator(new Authenticator(plugin, "/")); } - server.setExecutor(Executors.newSingleThreadExecutor()); + + server.setExecutor(new ThreadPoolExecutor(4, 8, 30, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100))); server.start(); enabled = true;