From 9889f64daa9449ae29fe1d7e371affeb730dc8de Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 26 May 2023 14:09:50 +0200 Subject: [server] Assign proper names to threads and thread pools --- .../src/main/java/org/openslx/bwlp/sat/App.java | 16 ++++++++-------- .../java/org/openslx/bwlp/sat/fileserv/FileServer.java | 2 +- .../openslx/bwlp/sat/fileserv/SyncTransferHandler.java | 2 +- .../main/java/org/openslx/bwlp/sat/web/WebServer.java | 3 ++- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/App.java b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/App.java index 3b1a8de6..717ef221 100644 --- a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/App.java +++ b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/App.java @@ -164,29 +164,29 @@ public class App { DeleteOldUsers.init(); // Shared executor for SSL thrift and HTTP thrift - ExecutorService es = new GrowingThreadPoolExecutor(3, 128, 1, TimeUnit.MINUTES, - new ArrayBlockingQueue(4), new PrioThreadFactory("SSL")); + ExecutorService es = new GrowingThreadPoolExecutor(3, 128, 2, TimeUnit.MINUTES, + new ArrayBlockingQueue(4), new PrioThreadFactory("Web/SSL")); // Start Thrift Server Thread t; // Plain - t = new Thread(new BinaryListener(9090, false, null)); + t = new Thread(new BinaryListener(9090, false, null), "T-Pln:9090"); t.setDaemon(true); t.start(); // SSL - t = new Thread(new BinaryListener(9091, true, es)); + t = new Thread(new BinaryListener(9091, true, es), "T-SSL:9091"); t.start(); // Start RPC httpd - t = new Thread(new WebServer(9080)); + t = new Thread(new WebServer(9080), "Rhttpd:9080"); t.setDaemon(true); t.start(); - // Start RPC httpd - t = new Thread(new JsonHttpListener(9081, es)); + // Start JSON-Thrift httpd + t = new Thread(new JsonHttpListener(9081, es), "Thttpd:9081"); t.setDaemon(true); t.start(); - Runtime.getRuntime().addShutdownHook(new Thread() { + Runtime.getRuntime().addShutdownHook(new Thread("Shutdown") { @Override public void run() { QuickTimer.cancel(); diff --git a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/fileserv/FileServer.java b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/fileserv/FileServer.java index 85f459c9..0d283848 100644 --- a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/fileserv/FileServer.java +++ b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/fileserv/FileServer.java @@ -47,7 +47,7 @@ public class FileServer implements IncomingEvent { private final ExecutorService transferPool = new GrowingThreadPoolExecutor(1, Constants.MAX_UPLOADS + Constants.MAX_DOWNLOADS, 1, TimeUnit.MINUTES, new SynchronousQueue(), - new PrioThreadFactory("ClientTransferPool", Thread.NORM_PRIORITY - 2)); + new PrioThreadFactory("CTransf", Thread.NORM_PRIORITY - 2)); /** * All currently running uploads, indexed by token diff --git a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/fileserv/SyncTransferHandler.java b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/fileserv/SyncTransferHandler.java index e8bdc83a..448bcb68 100644 --- a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/fileserv/SyncTransferHandler.java +++ b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/fileserv/SyncTransferHandler.java @@ -46,7 +46,7 @@ public class SyncTransferHandler { private static final GrowingThreadPoolExecutor transferPool = new GrowingThreadPoolExecutor(1, Constants.MAX_MASTER_UPLOADS + Constants.MAX_MASTER_DOWNLOADS, 1, TimeUnit.MINUTES, - new ArrayBlockingQueue(1), new PrioThreadFactory("MasterTransferPool", + new ArrayBlockingQueue(1), new PrioThreadFactory("MTransf", Thread.NORM_PRIORITY - 3)); /** diff --git a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/web/WebServer.java b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/web/WebServer.java index 3f32ae16..c3655572 100644 --- a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/web/WebServer.java +++ b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/web/WebServer.java @@ -28,6 +28,7 @@ import org.openslx.bwlp.thrift.iface.NetShareAuth; import org.openslx.bwlp.thrift.iface.TNotFoundException; import org.openslx.util.GrowingThreadPoolExecutor; import org.openslx.util.Json; +import org.openslx.util.PrioThreadFactory; import org.openslx.util.TarArchiveUtil.TarArchiveWriter; import org.openslx.util.Util; import org.simpleframework.xml.Serializer; @@ -40,7 +41,7 @@ public class WebServer extends NanoHTTPD { private static final Logger LOGGER = LogManager.getLogger(WebServer.class); private static final ThreadPoolExecutor tpe = new GrowingThreadPoolExecutor(1, 8, 1, TimeUnit.MINUTES, - new ArrayBlockingQueue(16)); + new ArrayBlockingQueue(16), new PrioThreadFactory("Web")); private static final Serializer serializer = new Persister(); -- cgit v1.2.3-55-g7522