13
0
geforkt von Mirrors/Velocity

More sane shutdown code.

Dieser Commit ist enthalten in:
Andrew Steinborn 2018-08-28 21:27:03 -04:00
Ursprung 5773fe240b
Commit b7725a7764

Datei anzeigen

@ -12,6 +12,7 @@ import com.velocitypowered.api.scheduler.TaskStatus;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import java.util.Collection;
import java.util.HashSet; import java.util.HashSet;
import java.util.IdentityHashMap; import java.util.IdentityHashMap;
import java.util.concurrent.*; import java.util.concurrent.*;
@ -41,7 +42,11 @@ public class VelocityScheduler implements Scheduler {
} }
public boolean shutdown() throws InterruptedException { public boolean shutdown() throws InterruptedException {
for (ScheduledTask task : ImmutableList.copyOf(tasksByPlugin.values())) { Collection<ScheduledTask> terminating;
synchronized (tasksByPlugin) {
terminating = ImmutableList.copyOf(tasksByPlugin.values());
}
for (ScheduledTask task : terminating) {
task.cancel(); task.cancel();
} }
timerExecutionService.shutdown(); timerExecutionService.shutdown();