Skip to content

Commit

Permalink
refactor: ♻️ refactor onInitialize
Browse files Browse the repository at this point in the history
  • Loading branch information
AnzhiZhang committed Oct 2, 2024
1 parent 831ce39 commit 34d59a1
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/main/java/com/zhanganzhi/chathub/ChatHub.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ public void onInitialize(ProxyInitializeEvent event) {
// core
Config config = Config.getInstance();
config.loadConfig(dataDirectory);
threadPoolExecutor = (ThreadPoolExecutor) Executors.newFixedThreadPool(
config.getCoreThreadPoolSize(),
new ThreadFactoryBuilder().setNameFormat("chathub-tasks-%d").build()
);
eventHub = new EventHub(this);

// command
Expand All @@ -59,12 +63,6 @@ public void onInitialize(ProxyInitializeEvent event) {
new VelocityCommand(this)
);

// thread pool
threadPoolExecutor = (ThreadPoolExecutor) Executors.newFixedThreadPool(
config.getCoreThreadPoolSize(),
new ThreadFactoryBuilder().setNameFormat("chathub-tasks-%d").build()
);

// init event hub
new Thread(() -> eventHub.start(), "chathub-event-hub-start-event").start();
}
Expand Down

0 comments on commit 34d59a1

Please sign in to comment.