mirror of
https://github.com/PaperMC/Velocity.git
synced 2025-03-07 15:57:17 +08:00
More sane shutdown code.
This commit is contained in:
parent
5773fe240b
commit
b7725a7764
@ -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();
|
||||||
|
Loading…
Reference in New Issue
Block a user