From 5e31b158e9a4fe251d826cf23df5c9db61f37aee Mon Sep 17 00:00:00 2001 From: md_5 Date: Thu, 21 Mar 2013 16:25:05 +1100 Subject: [PATCH] Work around JDK stupidity with regards to thread count --- proxy/src/main/java/net/md_5/bungee/BungeeCord.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java index 14b7a7de..755e1fcc 100644 --- a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java +++ b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java @@ -76,7 +76,8 @@ public class BungeeCord extends ProxyServer /** * Thread pools. */ - public final ScheduledExecutorService executors = new ScheduledThreadPoolExecutor( 8, new ThreadFactoryBuilder().setNameFormat( "Bungee Pool Thread #%1$d" ).build() ); + public final ScheduledThreadPoolExecutor executors = new ScheduledThreadPoolExecutor( Integer.MAX_VALUE, + new ThreadFactoryBuilder().setNameFormat( "Bungee Pool Thread #%1$d" ).build() ); public final MultithreadEventLoopGroup eventLoops = new NioEventLoopGroup( 0, new ThreadFactoryBuilder().setNameFormat( "Netty IO Thread #%1$d" ).build() ); /** * locations.yml save thread. @@ -186,6 +187,9 @@ public class BungeeCord extends ProxyServer @Override public void start() throws Exception { + executors.setKeepAliveTime( 60, TimeUnit.SECONDS ); + executors.allowCoreThreadTimeOut( true ); + pluginsFolder.mkdir(); pluginManager.loadPlugins( pluginsFolder ); config.load(); @@ -249,7 +253,7 @@ public class BungeeCord extends ProxyServer { this.isRunning = false; - httpClient.closeAsynchronously(); // TODO: Fix + httpClient.close(); executors.shutdown(); stopListeners();