mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-22 04:33:28 +01:00
Exit with non-zero exit code when killed by watchdog (#5732)
This commit is contained in:
parent
8c6e42583a
commit
e278cc1a3a
1 changed files with 5 additions and 1 deletions
|
@ -100,6 +100,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
// Spigot end
|
// Spigot end
|
||||||
|
|
||||||
+ public volatile Thread shutdownThread; // Paper
|
+ public volatile Thread shutdownThread; // Paper
|
||||||
|
+ public volatile boolean abnormalExit = false; // Paper
|
||||||
+
|
+
|
||||||
public static <S extends MinecraftServer> S a(Function<Thread, S> function) {
|
public static <S extends MinecraftServer> S a(Function<Thread, S> function) {
|
||||||
AtomicReference<S> atomicreference = new AtomicReference();
|
AtomicReference<S> atomicreference = new AtomicReference();
|
||||||
|
@ -261,10 +262,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
//this.remoteStatusListener.b(); // Paper - don't wait for remote connections
|
//this.remoteStatusListener.b(); // Paper - don't wait for remote connections
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- System.exit(0); // CraftBukkit
|
||||||
+ hasFullyShutdown = true; // Paper
|
+ hasFullyShutdown = true; // Paper
|
||||||
System.exit(0); // CraftBukkit
|
+ System.exit(this.abnormalExit ? 70 : 0); // CraftBukkit // Paper
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
||||||
@Override
|
@Override
|
||||||
public void stop() {
|
public void stop() {
|
||||||
|
@ -579,6 +582,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ RestartCommand.addShutdownHook( SpigotConfig.restartScript );
|
+ RestartCommand.addShutdownHook( SpigotConfig.restartScript );
|
||||||
+ }
|
+ }
|
||||||
+ // try one last chance to safe shutdown on main incase it 'comes back'
|
+ // try one last chance to safe shutdown on main incase it 'comes back'
|
||||||
|
+ server.abnormalExit = true;
|
||||||
+ server.safeShutdown(false, restart);
|
+ server.safeShutdown(false, restart);
|
||||||
+ try {
|
+ try {
|
||||||
+ Thread.sleep(1000);
|
+ Thread.sleep(1000);
|
||||||
|
|
Loading…
Add table
Reference in a new issue