13
0
geforkt von Mirrors/Velocity

Ensure the proxy doesn't shut down too early if stdin is EOF.

Dieser Commit ist enthalten in:
Andrew Steinborn 2019-05-23 14:50:58 -04:00
Ursprung b881e9cf04
Commit df7eb4ade0
3 geänderte Dateien mit 13 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -45,5 +45,10 @@ public class Velocity {
double bootTime = (System.currentTimeMillis() - startTime) / 1000d;
logger.info("Done ({}s)!", new DecimalFormat("#.##").format(bootTime));
server.getConsoleCommandSource().start();
// If we don't have a console available (because SimpleTerminalConsole returned), then we still
// need to wait, otherwise the JVM will reap us as no non-daemon threads will be active once the
// main thread exits.
server.awaitProxyShutdown();
}
}

Datei anzeigen

@ -138,6 +138,10 @@ public class VelocityServer implements ProxyServer {
return commandManager;
}
void awaitProxyShutdown() {
cm.getBossGroup().terminationFuture().syncUninterruptibly();
}
@EnsuresNonNull({"serverKeyPair", "servers", "pluginManager", "eventManager", "scheduler",
"console", "cm", "configuration"})
void start() {

Datei anzeigen

@ -160,6 +160,10 @@ public final class ConnectionManager {
}
}
public EventLoopGroup getBossGroup() {
return bossGroup;
}
public ServerChannelInitializerHolder getServerChannelInitializer() {
return this.serverChannelInitializer;
}