Patch delayed executor service not fully stopping when requested.

This commit is contained in:
Zontreck 2024-02-18 04:00:34 -07:00
parent fc6db84289
commit 75557bf90c

View file

@ -20,14 +20,7 @@ public class DelayedExecutorService {
private static ScheduledThreadPoolExecutor repeater; private static ScheduledThreadPoolExecutor repeater;
static{ static{
inst=new DelayedExecutorService(); inst=new DelayedExecutorService();
repeater = new ScheduledThreadPoolExecutor(8); repeater = new ScheduledThreadPoolExecutor(2);
repeater.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
DelayedExecutorService.getInstance().onTick();
}
}, 250L, 250L, TimeUnit.MILLISECONDS);
} }
private DelayedExecutorService(){} private DelayedExecutorService(){}
@ -55,13 +48,13 @@ public class DelayedExecutorService {
public static void setup() public static void setup()
{ {
stopRepeatingThread(); stopRepeatingThread();
repeater = new ScheduledThreadPoolExecutor(8); repeater = new ScheduledThreadPoolExecutor(16);
repeater.schedule(new Runnable() { repeater.scheduleAtFixedRate(new Runnable() {
@Override @Override
public void run() { public void run() {
DelayedExecutorService.getInstance().onTick(); DelayedExecutorService.getInstance().onTick();
} }
}, 1L, TimeUnit.SECONDS); }, 1L, 1L, TimeUnit.SECONDS);
} }
/** /**
@ -70,6 +63,7 @@ public class DelayedExecutorService {
public static void stop() public static void stop()
{ {
RUN.set(false); RUN.set(false);
stopRepeatingThread();
} }
/** /**