playertype, enum singleton

This commit is contained in:
ingmargoudt 2017-04-02 20:02:14 +02:00
parent b19170f34f
commit 211d433ea9
50 changed files with 642 additions and 675 deletions

View file

@ -38,8 +38,8 @@ import java.util.concurrent.TimeUnit;
*
* @author BetaSteward_at_googlemail.com
*/
public class ThreadExecutor {
public enum ThreadExecutor {
instance;
private static final ExecutorService callExecutor = Executors.newCachedThreadPool();
private static final ExecutorService userExecutor = Executors.newCachedThreadPool();
private static final ExecutorService gameExecutor = Executors.newFixedThreadPool(ConfigSettings.instance.getMaxGameThreads());
@ -74,14 +74,6 @@ public class ThreadExecutor {
((ThreadPoolExecutor) timeoutIdleExecutor).setThreadFactory(new XMageThreadFactory("TIMEOUT_IDLE"));
}
private static final ThreadExecutor INSTANCE = new ThreadExecutor();
public static ThreadExecutor getInstance() {
return INSTANCE;
}
private ThreadExecutor() {
}
public int getActiveThreads(ExecutorService executerService) {
if (executerService instanceof ThreadPoolExecutor) {