#1130: Add scheduler unit tests and make more robust.

This commit is contained in:
md_5
2015-01-18 12:09:38 +11:00
parent 28496e0471
commit cf722de1d2
6 changed files with 123 additions and 9 deletions

View File

@@ -96,8 +96,9 @@ public class Plugin
{
if ( service == null )
{
service = Executors.newCachedThreadPool( new ThreadFactoryBuilder().setNameFormat( getDescription().getName() + " Pool Thread #%1$d" )
.setThreadFactory( new GroupedThreadFactory( this ) ).build() );
String name = ( getDescription() == null ) ? "unknown" : getDescription().getName();
service = Executors.newCachedThreadPool( new ThreadFactoryBuilder().setNameFormat( name + " Pool Thread #%1$d" )
.setThreadFactory( new GroupedThreadFactory( this, name ) ).build() );
}
return service;
}

View File

@@ -21,9 +21,9 @@ public class GroupedThreadFactory implements ThreadFactory
}
public GroupedThreadFactory(Plugin plugin)
public GroupedThreadFactory(Plugin plugin, String name)
{
this.group = new BungeeGroup( plugin.getDescription().getName() );
this.group = new BungeeGroup( name );
}
@Override