geforkt von Mirrors/Velocity
Merge branch 'master' of https://github.com/astei/velocity into config
Dieser Commit ist enthalten in:
Commit
d743c8b5a1
@ -112,6 +112,7 @@ public class VelocityServer implements ProxyServer {
|
|||||||
|
|
||||||
if (!configuration.validate()) {
|
if (!configuration.validate()) {
|
||||||
logger.error("Your configuration is invalid. Velocity will refuse to start up until the errors are resolved.");
|
logger.error("Your configuration is invalid. Velocity will refuse to start up until the errors are resolved.");
|
||||||
|
LogManager.shutdown();
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,6 +120,7 @@ public class VelocityServer implements ProxyServer {
|
|||||||
|
|
||||||
} catch (IOException | RuntimeException e) {
|
} catch (IOException | RuntimeException e) {
|
||||||
logger.error("Unable to load your velocity.toml. The server will shut down.", e);
|
logger.error("Unable to load your velocity.toml. The server will shut down.", e);
|
||||||
|
LogManager.shutdown();
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,8 @@ 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.ArrayList;
|
import java.util.Collection;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.IdentityHashMap;
|
import java.util.IdentityHashMap;
|
||||||
import java.util.concurrent.*;
|
import java.util.concurrent.*;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
@ -21,8 +22,8 @@ public class VelocityScheduler implements Scheduler {
|
|||||||
private final PluginManager pluginManager;
|
private final PluginManager pluginManager;
|
||||||
private final ExecutorService taskService;
|
private final ExecutorService taskService;
|
||||||
private final ScheduledExecutorService timerExecutionService;
|
private final ScheduledExecutorService timerExecutionService;
|
||||||
private final Multimap<Object, ScheduledTask> tasksByPlugin = Multimaps.synchronizedListMultimap(
|
private final Multimap<Object, ScheduledTask> tasksByPlugin = Multimaps.synchronizedMultimap(
|
||||||
Multimaps.newListMultimap(new IdentityHashMap<>(), ArrayList::new));
|
Multimaps.newSetMultimap(new IdentityHashMap<>(), HashSet::new));
|
||||||
|
|
||||||
public VelocityScheduler(PluginManager pluginManager) {
|
public VelocityScheduler(PluginManager pluginManager) {
|
||||||
this.pluginManager = pluginManager;
|
this.pluginManager = pluginManager;
|
||||||
@ -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();
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren