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
|
@ -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…
Add table
Add a link
Reference in a new issue