3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-12-23 23:00:35 +01:00

Merge branch 'master' of https://github.com/astei/velocity into config

Dieser Commit ist enthalten in:
Leymooo 2018-08-31 16:38:28 +03:00
Commit d743c8b5a1
2 geänderte Dateien mit 11 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -112,6 +112,7 @@ public class VelocityServer implements ProxyServer {
if (!configuration.validate()) {
logger.error("Your configuration is invalid. Velocity will refuse to start up until the errors are resolved.");
LogManager.shutdown();
System.exit(1);
}
@ -119,6 +120,7 @@ public class VelocityServer implements ProxyServer {
} catch (IOException | RuntimeException e) {
logger.error("Unable to load your velocity.toml. The server will shut down.", e);
LogManager.shutdown();
System.exit(1);
}

Datei anzeigen

@ -12,7 +12,8 @@ import com.velocitypowered.api.scheduler.TaskStatus;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.IdentityHashMap;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicReference;
@ -21,8 +22,8 @@ public class VelocityScheduler implements Scheduler {
private final PluginManager pluginManager;
private final ExecutorService taskService;
private final ScheduledExecutorService timerExecutionService;
private final Multimap<Object, ScheduledTask> tasksByPlugin = Multimaps.synchronizedListMultimap(
Multimaps.newListMultimap(new IdentityHashMap<>(), ArrayList::new));
private final Multimap<Object, ScheduledTask> tasksByPlugin = Multimaps.synchronizedMultimap(
Multimaps.newSetMultimap(new IdentityHashMap<>(), HashSet::new));
public VelocityScheduler(PluginManager pluginManager) {
this.pluginManager = pluginManager;
@ -41,7 +42,11 @@ public class VelocityScheduler implements Scheduler {
}
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();
}
timerExecutionService.shutdown();