Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-17 05:20:14 +01:00
Move proxy shutdown to take place in a new thread.
Dieser Commit ist enthalten in:
Ursprung
df7eb4ade0
Commit
3cee15a9cb
@ -355,30 +355,36 @@ public class VelocityServer implements ProxyServer {
|
|||||||
if (!shutdownInProgress.compareAndSet(false, true)) {
|
if (!shutdownInProgress.compareAndSet(false, true)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
logger.info("Shutting down the proxy...");
|
|
||||||
|
|
||||||
for (ConnectedPlayer player : ImmutableList.copyOf(connectionsByUuid.values())) {
|
Runnable shutdownProcess = () -> {
|
||||||
player.disconnect(TextComponent.of("Proxy shutting down."));
|
logger.info("Shutting down the proxy...");
|
||||||
}
|
|
||||||
|
|
||||||
this.cm.shutdown();
|
for (ConnectedPlayer player : ImmutableList.copyOf(connectionsByUuid.values())) {
|
||||||
|
player.disconnect(TextComponent.of("Proxy shutting down."));
|
||||||
try {
|
|
||||||
if (!eventManager.shutdown() || !scheduler.shutdown()) {
|
|
||||||
logger.error("Your plugins took over 10 seconds to shut down.");
|
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
|
||||||
// Not much we can do about this...
|
|
||||||
Thread.currentThread().interrupt();
|
|
||||||
}
|
|
||||||
|
|
||||||
eventManager.fireShutdownEvent();
|
this.cm.shutdown();
|
||||||
|
|
||||||
shutdown = true;
|
try {
|
||||||
|
if (!eventManager.shutdown() || !scheduler.shutdown()) {
|
||||||
|
logger.error("Your plugins took over 10 seconds to shut down.");
|
||||||
|
}
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
// Not much we can do about this...
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
}
|
||||||
|
|
||||||
if (explicitExit) {
|
eventManager.fireShutdownEvent();
|
||||||
System.exit(0);
|
|
||||||
}
|
shutdown = true;
|
||||||
|
|
||||||
|
if (explicitExit) {
|
||||||
|
System.exit(0);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Thread thread = new Thread(shutdownProcess);
|
||||||
|
thread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public NettyHttpClient getHttpClient() {
|
public NettyHttpClient getHttpClient() {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren