refactor: inline thread name

This commit is contained in:
ChomeNS
2025-04-03 10:02:23 +07:00
parent e80530c847
commit 8ce017f7d0
3 changed files with 8 additions and 6 deletions

View File

@@ -83,8 +83,7 @@ public class Main {
config = yaml.load(reader);
final Thread shutdownThread = new Thread(Main::handleShutdown);
shutdownThread.setName("ChomeNS Bot Shutdown Thread");
final Thread shutdownThread = new Thread(Main::handleShutdown, "ChomeNS Bot Shutdown Thread");
Runtime.getRuntime().addShutdownHook(shutdownThread);
if (!config.backup.enabled) {

View File

@@ -12,9 +12,10 @@ import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
public class DatabasePlugin {
public static final ExecutorService executorService = Executors.newFixedThreadPool(
1,
new ThreadFactoryBuilder().setNameFormat("ExecutorService (database)").build()
public static final ExecutorService executorService = Executors.newSingleThreadExecutor(
new ThreadFactoryBuilder()
.setNameFormat("ExecutorService (database)")
.build()
);
public Connection connection;

View File

@@ -35,7 +35,9 @@ public class FileLoggerUtilities {
// we want a completely separate executor from the main one
public static final ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor(
new ThreadFactoryBuilder().setNameFormat("ScheduledExecutorService (logger)").build()
new ThreadFactoryBuilder()
.setNameFormat("ScheduledExecutorService (logger)")
.build()
);
public static int spamLevel = 0;