make executors MORE global

like global, global for every server.
This commit is contained in:
Chayapak 2023-05-05 18:42:57 +07:00
parent ac0e77de74
commit 1db8b72be6
2 changed files with 5 additions and 1 deletions

View file

@ -40,7 +40,7 @@ public class Bot {
@Getter private boolean loggedIn = false; @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 ConsolePlugin console;
@Getter @Setter private LoggerPlugin logger; // in ConsolePlugin @Getter @Setter private LoggerPlugin logger; // in ConsolePlugin

View file

@ -11,10 +11,14 @@ import javax.security.auth.login.LoginException;
import java.io.*; import java.io.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
public class Main { public class Main {
public static final List<Bot> bots = new ArrayList<>(); public static final List<Bot> bots = new ArrayList<>();
public static final ScheduledExecutorService executor = Executors.newScheduledThreadPool(50);
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
final File file = new File("config.yml"); final File file = new File("config.yml");
final Constructor constructor = new Constructor(Configuration.class); final Constructor constructor = new Constructor(Configuration.class);