From 71a71f506fa6163bf30d4c70aba5d50f5f8cd9ef Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 22 May 2024 16:49:20 +0200 Subject: Replace growing thread pool by cascaded one Cascaded thread pools have a shared common fallback pool that will take over when a specific thread pool instance is overloaded. --- src/main/java/fi/iki/elonen/NanoHTTPD.java | 33 ------------------------------ 1 file changed, 33 deletions(-) (limited to 'src/main/java/fi') diff --git a/src/main/java/fi/iki/elonen/NanoHTTPD.java b/src/main/java/fi/iki/elonen/NanoHTTPD.java index 395eca7..0d21381 100644 --- a/src/main/java/fi/iki/elonen/NanoHTTPD.java +++ b/src/main/java/fi/iki/elonen/NanoHTTPD.java @@ -60,15 +60,11 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; import java.util.StringTokenizer; -import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.ExecutorService; import java.util.concurrent.RejectedExecutionException; -import java.util.concurrent.TimeUnit; import org.apache.commons.io.input.BoundedInputStream; import org.apache.commons.io.output.ByteArrayOutputStream; -import org.openslx.util.GrowingThreadPoolExecutor; -import org.openslx.util.PrioThreadFactory; import org.openslx.util.Util; /** @@ -154,35 +150,6 @@ public abstract class NanoHTTPD implements Runnable protected int maxRequestSize = 0; - /** - * Constructs an HTTP server on given port. - */ - public NanoHTTPD( int port ) throws IOException - { - this( null, port ); - } - - /** - * @param hostname Address to listen on - * @param port Port to listen on - */ - public NanoHTTPD( String hostname, int port ) throws IOException - { - this( hostname, port, 24, 16 ); - } - - /** - * @param hostname Address to listen on - * @param port Port to listen on - * @param maxThreads Maximum number of threads to spawn before we start queuing requests - * @param maxQueue Maximum number of requests we queue before we start rejecting them with 503 - */ - public NanoHTTPD( String hostname, int port, int maxThreads, int maxQueue ) throws IOException - { - this( hostname, port, new GrowingThreadPoolExecutor( 2, maxThreads, 1, TimeUnit.MINUTES, - new ArrayBlockingQueue( maxQueue ), new PrioThreadFactory( "httpd" ) ) ); - } - /** * Constructs an HTTP server on given hostname and port. */ -- cgit v1.2.3-55-g7522