[FIX] Use custom thread factory in autorefresh

This commit is contained in:
Gravita 2023-10-29 03:30:13 +07:00
parent fce8453bd1
commit 9e83e8bec8

View file

@ -37,7 +37,12 @@ public abstract class Request<R extends WebSocketEvent> implements WebSocketRequ
public static synchronized void startAutoRefresh() { public static synchronized void startAutoRefresh() {
if(!autoRefreshRunning) { if(!autoRefreshRunning) {
if(executorService == null) { if(executorService == null) {
executorService = Executors.newSingleThreadScheduledExecutor(); executorService = Executors.newSingleThreadScheduledExecutor((t) -> {
Thread thread = new Thread(t);
thread.setName("AutoRefresh thread");
thread.setDaemon(true);
return thread;
});
} }
executorService.scheduleAtFixedRate(() -> { executorService.scheduleAtFixedRate(() -> {
try { try {