Attempt to fix a null error

This commit is contained in:
Zontreck 2024-02-18 09:22:41 -07:00
parent aba2f101dc
commit bba75793dd

View file

@ -21,6 +21,12 @@ public class DelayedExecutorService {
static{ static{
inst=new DelayedExecutorService(); inst=new DelayedExecutorService();
repeater = new ScheduledThreadPoolExecutor(16); repeater = new ScheduledThreadPoolExecutor(16);
repeater.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
DelayedExecutorService.getInstance().onTick();
}
}, 1L, 1L, TimeUnit.SECONDS);
} }
private DelayedExecutorService(){} private DelayedExecutorService(){}
@ -45,14 +51,9 @@ public class DelayedExecutorService {
/** /**
* This function is designed to set back up the executor if it was previously stopped and restarted. * This function is designed to set back up the executor if it was previously stopped and restarted.
*/ */
@Deprecated
public static void setup() public static void setup()
{ {
repeater.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
DelayedExecutorService.getInstance().onTick();
}
}, 1L, 1L, TimeUnit.SECONDS);
} }
/** /**
@ -143,10 +144,6 @@ public class DelayedExecutorService {
public void onTick() public void onTick()
{ {
if(!isRunning())
{
DelayedExecutorService.stopRepeatingThread();
}
/*Iterator<DelayedExecution> it = EXECUTORS.iterator(); /*Iterator<DelayedExecution> it = EXECUTORS.iterator();
try{ try{