summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2024-05-22 16:52:24 +0200
committerSimon Rettberg2024-05-22 16:52:24 +0200
commite626b18e4c83d170729f73c77582d6427c38c709 (patch)
tree2b43f35bcb2526258d1756723f4b6e1eaa56be50
parentUpdate import-idp script (diff)
downloadmasterserver-e626b18e4c83d170729f73c77582d6427c38c709.tar.gz
masterserver-e626b18e4c83d170729f73c77582d6427c38c709.tar.xz
masterserver-e626b18e4c83d170729f73c77582d6427c38c709.zip
Switch to new CascadedThreadPool
-rw-r--r--src/main/java/org/openslx/imagemaster/serverconnection/ConnectionHandler.java6
-rw-r--r--src/main/java/org/openslx/imagemaster/thrift/server/HttpListener.java4
2 files changed, 6 insertions, 4 deletions
diff --git a/src/main/java/org/openslx/imagemaster/serverconnection/ConnectionHandler.java b/src/main/java/org/openslx/imagemaster/serverconnection/ConnectionHandler.java
index 8b6d197..f3831b0 100644
--- a/src/main/java/org/openslx/imagemaster/serverconnection/ConnectionHandler.java
+++ b/src/main/java/org/openslx/imagemaster/serverconnection/ConnectionHandler.java
@@ -33,7 +33,7 @@ import org.openslx.filetransfer.Uploader;
import org.openslx.imagemaster.Globals;
import org.openslx.imagemaster.db.mappers.DbImage;
import org.openslx.thrifthelper.ImagePublishDataEx;
-import org.openslx.util.GrowingThreadPoolExecutor;
+import org.openslx.util.CascadedThreadPoolExecutor;
import org.openslx.util.QuickTimer;
import org.openslx.util.QuickTimer.Task;
@@ -53,9 +53,9 @@ public class ConnectionHandler implements IncomingEvent
private static Map<String, OutgoingTransfer> outgoingTransfers = new ConcurrentHashMap<>();
private static IncomingEvent eventHandler = new ConnectionHandler();
- private final ExecutorService transferPool = new GrowingThreadPoolExecutor( 1, MAX_TRANSFERS * 2, 1, TimeUnit.MINUTES,
+ private final ExecutorService transferPool = new CascadedThreadPoolExecutor( 1, MAX_TRANSFERS * 2, 1, TimeUnit.MINUTES,
new SynchronousQueue<Runnable>(),
- new PrioThreadFactory( "TransferPool", Thread.NORM_PRIORITY - 2 ) );
+ new PrioThreadFactory( "TransferPool", Thread.NORM_PRIORITY - 2 ), null );
private static final Listener plainListener;
private static final Listener sslListener;
diff --git a/src/main/java/org/openslx/imagemaster/thrift/server/HttpListener.java b/src/main/java/org/openslx/imagemaster/thrift/server/HttpListener.java
index b56f64e..b39d993 100644
--- a/src/main/java/org/openslx/imagemaster/thrift/server/HttpListener.java
+++ b/src/main/java/org/openslx/imagemaster/thrift/server/HttpListener.java
@@ -2,6 +2,7 @@ package org.openslx.imagemaster.thrift.server;
import java.io.IOException;
import java.util.Arrays;
+import java.util.concurrent.TimeUnit;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -9,6 +10,7 @@ import org.apache.thrift.protocol.TJSONProtocol;
import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.transport.TMemoryBuffer;
import org.openslx.bwlp.thrift.iface.MasterServer;
+import org.openslx.util.CascadedThreadPoolExecutor;
import org.openslx.util.Util;
import fi.iki.elonen.NanoHTTPD;
@@ -23,7 +25,7 @@ public class HttpListener extends NanoHTTPD
public HttpListener( String hostname, int port ) throws IOException
{
- super( hostname, port, 64, 16 );
+ super( hostname, port, new CascadedThreadPoolExecutor( 4, 32, 1, TimeUnit.MINUTES, 2, "HTTP" ) );
this.maxRequestSize = 1_000_000;
}