mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-11-24 11:15:47 +01:00
Use Bungee thread pool for additional logging
This commit is contained in:
parent
5e31b158e9
commit
3d8143c36e
@ -50,6 +50,7 @@ import net.md_5.bungee.config.YamlConfig;
|
||||
import net.md_5.bungee.netty.PipelineUtils;
|
||||
import net.md_5.bungee.packet.DefinedPacket;
|
||||
import net.md_5.bungee.packet.PacketFAPluginMessage;
|
||||
import net.md_5.bungee.scheduler.BungeeThreadPool;
|
||||
|
||||
/**
|
||||
* Main BungeeCord proxy class.
|
||||
@ -76,7 +77,7 @@ public class BungeeCord extends ProxyServer
|
||||
/**
|
||||
* Thread pools.
|
||||
*/
|
||||
public final ScheduledThreadPoolExecutor executors = new ScheduledThreadPoolExecutor( Integer.MAX_VALUE,
|
||||
public final ScheduledThreadPoolExecutor executors = new BungeeThreadPool( 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() );
|
||||
/**
|
||||
|
@ -0,0 +1,25 @@
|
||||
package net.md_5.bungee.scheduler;
|
||||
|
||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
import java.util.logging.Level;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
|
||||
public class BungeeThreadPool extends ScheduledThreadPoolExecutor
|
||||
{
|
||||
|
||||
public BungeeThreadPool(int corePoolSize, ThreadFactory threadFactory)
|
||||
{
|
||||
super( corePoolSize, threadFactory );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void afterExecute(Runnable r, Throwable t)
|
||||
{
|
||||
super.afterExecute( r, t );
|
||||
if ( t != null )
|
||||
{
|
||||
ProxyServer.getInstance().getLogger().log( Level.SEVERE, "Task caused exception whilst running", t );
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user