Attempt to resolve a concurrent modification exception inside of DelayedExecutorService#onTick
This commit is contained in:
parent
ab51609213
commit
8be88eedda
2 changed files with 13 additions and 10 deletions
|
@ -12,7 +12,7 @@ plugins {
|
|||
id 'maven-publish'
|
||||
}
|
||||
|
||||
version = "1.1.9"
|
||||
version = "1.1.10"
|
||||
group = "dev.zontreck"
|
||||
archivesBaseName = "LibAC"
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||
|
|
|
@ -126,17 +126,20 @@ public class DelayedExecutorService {
|
|||
DelayedExecutorService.stopRepeatingThread();
|
||||
}
|
||||
Iterator<DelayedExecution> it = EXECUTORS.iterator();
|
||||
while(it.hasNext())
|
||||
{
|
||||
DelayedExecution e = it.next();
|
||||
if(e.unix_time < Instant.now().getEpochSecond())
|
||||
try{
|
||||
|
||||
while(it.hasNext())
|
||||
{
|
||||
it.remove();
|
||||
Thread tx = new Thread(e.scheduled);
|
||||
tx.setName("DelayedExecutorTask-"+String.valueOf(DelayedExecutorService.getNext()));
|
||||
tx.start();
|
||||
DelayedExecution e = it.next();
|
||||
if(e.unix_time < Instant.now().getEpochSecond())
|
||||
{
|
||||
it.remove();
|
||||
Thread tx = new Thread(e.scheduled);
|
||||
tx.setName("DelayedExecutorTask-"+String.valueOf(DelayedExecutorService.getNext()));
|
||||
tx.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch(Exception e){}
|
||||
}
|
||||
|
||||
public static int getNext()
|
||||
|
|
Loading…
Reference in a new issue