From 1db8b72be6ee594064b53bac789ef652f93cbfa2 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Fri, 5 May 2023 18:42:57 +0700 Subject: [PATCH] make executors MORE global like global, global for every server. --- src/main/java/land/chipmunk/chayapak/chomens_bot/Bot.java | 2 +- src/main/java/land/chipmunk/chayapak/chomens_bot/Main.java | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/Bot.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/Bot.java index 9dd999c..b6bac31 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/Bot.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/Bot.java @@ -40,7 +40,7 @@ public class Bot { @Getter private boolean loggedIn = false; - @Getter private final ScheduledExecutorService executor = Executors.newScheduledThreadPool(100); + @Getter private final ScheduledExecutorService executor = Main.executor; @Getter @Setter private ConsolePlugin console; @Getter @Setter private LoggerPlugin logger; // in ConsolePlugin diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/Main.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/Main.java index c5dc36c..bc912ec 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/Main.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/Main.java @@ -11,10 +11,14 @@ import javax.security.auth.login.LoginException; import java.io.*; import java.util.ArrayList; import java.util.List; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; public class Main { public static final List bots = new ArrayList<>(); + public static final ScheduledExecutorService executor = Executors.newScheduledThreadPool(50); + public static void main(String[] args) throws IOException { final File file = new File("config.yml"); final Constructor constructor = new Constructor(Configuration.class);