Increase thread pool timeout to try and reduce churn

This commit is contained in:
md_5 2013-04-30 11:32:29 +10:00
parent 3132d2c7cf
commit 09d04c34cb
2 changed files with 6 additions and 7 deletions

View File

@ -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();

View File

@ -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