mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-11-22 02:26:00 +01:00
Improve thread-pool-settings for the WebServer
This commit is contained in:
parent
5a342e1fe0
commit
ad809600b6
@ -31,10 +31,7 @@
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketException;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.*;
|
||||
|
||||
public class WebServer extends Thread {
|
||||
|
||||
@ -68,8 +65,7 @@ public WebServer(InetAddress bindAddress, int port, int maxConnections, HttpRequ
|
||||
public synchronized void start() {
|
||||
close();
|
||||
|
||||
connectionThreads = new ThreadPoolExecutor(maxConnections, maxConnections, 10, TimeUnit.SECONDS, new LinkedBlockingQueue<>());
|
||||
connectionThreads.allowCoreThreadTimeOut(true);
|
||||
connectionThreads = new ThreadPoolExecutor(Math.min(maxConnections, 8), maxConnections, 10, TimeUnit.SECONDS, new LinkedBlockingQueue<>());
|
||||
|
||||
try {
|
||||
server = new ServerSocket(port, maxConnections, bindAddress);
|
||||
|
Loading…
Reference in New Issue
Block a user