From a92f507aa59da9862f27c59d6fb3c53faac817d1 Mon Sep 17 00:00:00 2001 From: Cedric Date: Thu, 19 Oct 2023 16:23:33 +0200 Subject: [PATCH] ref: changed Executor --- .../com/troblecodings/signals/handler/NameHandler.java | 8 ++++---- .../troblecodings/signals/handler/SignalStateHandler.java | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) 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,