diff --git a/src/main/java/com/troblecodings/signals/handler/NameHandler.java b/src/main/java/com/troblecodings/signals/handler/NameHandler.java index d182915bb..a5cdd3572 100644 --- a/src/main/java/com/troblecodings/signals/handler/NameHandler.java +++ b/src/main/java/com/troblecodings/signals/handler/NameHandler.java @@ -43,8 +43,8 @@ public final class NameHandler implements INetworkSync { - private static ExecutorService WRITE_SERVICE = Executors.newFixedThreadPool(4); - private static ExecutorService READ_SERVICE = Executors.newFixedThreadPool(20); + private static ExecutorService WRITE_SERVICE = Executors.newFixedThreadPool(5); + private static ExecutorService READ_SERVICE = Executors.newCachedThreadPool(); private static final Map ALL_NAMES = new HashMap<>(); private static final Map ALL_LEVEL_FILES = new HashMap<>(); private static final Map LOAD_COUNTER = new HashMap<>(); @@ -66,8 +66,8 @@ public static void onServerStop(final FMLServerStoppingEvent event) { } catch (final InterruptedException e) { e.printStackTrace(); } - READ_SERVICE = Executors.newFixedThreadPool(20); - WRITE_SERVICE = Executors.newFixedThreadPool(4); + READ_SERVICE = Executors.newCachedThreadPool(); + WRITE_SERVICE = Executors.newFixedThreadPool(5); } public static void registerToNetworkChannel(final Object obj) { diff --git a/src/main/java/com/troblecodings/signals/handler/SignalStateHandler.java b/src/main/java/com/troblecodings/signals/handler/SignalStateHandler.java index 1481bea0f..3d8983b88 100644 --- a/src/main/java/com/troblecodings/signals/handler/SignalStateHandler.java +++ b/src/main/java/com/troblecodings/signals/handler/SignalStateHandler.java @@ -50,8 +50,8 @@ public final class SignalStateHandler implements INetworkSync { private SignalStateHandler() { } - private static ExecutorService READ_SERVICE = Executors.newFixedThreadPool(20); - private static ExecutorService WRITE_SERVICE = Executors.newFixedThreadPool(4); + private static ExecutorService READ_SERVICE = Executors.newCachedThreadPool(); + private static ExecutorService WRITE_SERVICE = Executors.newFixedThreadPool(5); private static final Map> CURRENTLY_LOADED_STATES = new HashMap<>(); private static final Map ALL_LEVEL_FILES = new HashMap<>(); private static final Map>> SIGNAL_COUNTER = new HashMap<>(); @@ -76,8 +76,8 @@ public static void onServerStop(final FMLServerStoppingEvent event) { } catch (final InterruptedException e) { e.printStackTrace(); } - READ_SERVICE = Executors.newFixedThreadPool(20); - WRITE_SERVICE = Executors.newFixedThreadPool(4); + READ_SERVICE = Executors.newCachedThreadPool(); + WRITE_SERVICE = Executors.newFixedThreadPool(5); } public static void createStates(final SignalStateInfo info,