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 af4aab26..dd5bcf52 100644 --- a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java +++ b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java @@ -78,8 +78,7 @@ public class BungeeCord extends ProxyServer /** * Thread pools. */ - public final ScheduledThreadPoolExecutor executors = new BungeeThreadPool( Integer.MAX_VALUE, - new ThreadFactoryBuilder().setNameFormat( "Bungee Pool Thread #%1$d" ).build() ); + public final ScheduledThreadPoolExecutor executors = new BungeeThreadPool( 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. @@ -190,9 +189,6 @@ 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(); diff --git a/proxy/src/main/java/net/md_5/bungee/scheduler/BungeeThreadPool.java b/proxy/src/main/java/net/md_5/bungee/scheduler/BungeeThreadPool.java index dde8ab40..9b2e3757 100644 --- a/proxy/src/main/java/net/md_5/bungee/scheduler/BungeeThreadPool.java +++ b/proxy/src/main/java/net/md_5/bungee/scheduler/BungeeThreadPool.java @@ -2,15 +2,18 @@ package net.md_5.bungee.scheduler; import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.ThreadFactory; +import java.util.concurrent.TimeUnit; import java.util.logging.Level; import net.md_5.bungee.api.ProxyServer; public class BungeeThreadPool extends ScheduledThreadPoolExecutor { - public BungeeThreadPool(int corePoolSize, ThreadFactory threadFactory) + public BungeeThreadPool(ThreadFactory threadFactory) { - super( corePoolSize, threadFactory ); + super( Integer.MAX_VALUE, threadFactory ); + setKeepAliveTime( 5, TimeUnit.MINUTES ); + allowCoreThreadTimeOut( true ); } @Override