Make watchdoge disabler its own patch file

Change implementation, smaller diff, less NPE
This commit is contained in:
Zach Brown 2016-05-12 23:04:49 -05:00
parent 6b016cfcbf
commit 4cfcd525c4
No known key found for this signature in database
GPG Key ID: CC9DA35FC5450B76
2 changed files with 25 additions and 11 deletions

View File

@ -1,4 +1,4 @@
From 1a9b35b6da96dd27d24b90dd432fc27a79615bc1 Mon Sep 17 00:00:00 2001 From 16b868449a03eefbd94542578d058176425e41ae Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com> From: Zach Brown <zach.brown@destroystokyo.com>
Date: Tue, 1 Mar 2016 14:32:43 -0600 Date: Tue, 1 Mar 2016 14:32:43 -0600
Subject: [PATCH] Show 'Paper' in client crashes, server lists, and Mojang Subject: [PATCH] Show 'Paper' in client crashes, server lists, and Mojang
@ -46,10 +46,10 @@ index 3f27fe6..52155e8 100644
private final String bukkitVersion = Versioning.getBukkitVersion(); private final String bukkitVersion = Versioning.getBukkitVersion();
private final Logger logger = Logger.getLogger("Minecraft"); private final Logger logger = Logger.getLogger("Minecraft");
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
index 94a3d42..6898b56 100644 index 94a3d42..3ed983c 100644
--- a/src/main/java/org/spigotmc/WatchdogThread.java --- a/src/main/java/org/spigotmc/WatchdogThread.java
+++ b/src/main/java/org/spigotmc/WatchdogThread.java +++ b/src/main/java/org/spigotmc/WatchdogThread.java
@@ -19,14 +19,14 @@ public class WatchdogThread extends Thread @@ -19,7 +19,7 @@ public class WatchdogThread extends Thread
private WatchdogThread(long timeoutTime, boolean restart) private WatchdogThread(long timeoutTime, boolean restart)
{ {
@ -58,14 +58,6 @@ index 94a3d42..6898b56 100644
this.timeoutTime = timeoutTime; this.timeoutTime = timeoutTime;
this.restart = restart; this.restart = restart;
} }
public static void doStart(int timeoutTime, boolean restart)
{
- if ( instance == null )
+ if ( !Boolean.getBoolean("disable.watchdog") && instance == null ) // Paper - Add property to disable
{
instance = new WatchdogThread( timeoutTime * 1000L, restart );
instance.start();
@@ -56,9 +56,9 @@ public class WatchdogThread extends Thread @@ -56,9 +56,9 @@ public class WatchdogThread extends Thread
{ {
Logger log = Bukkit.getServer().getLogger(); Logger log = Bukkit.getServer().getLogger();

View File

@ -0,0 +1,22 @@
From 00816855c6c0d23f13289a10f4e8329ea47ec3f0 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Thu, 12 May 2016 23:02:58 -0500
Subject: [PATCH] System property for disabling watchdoge
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
index 3ed983c..fb57e0d 100644
--- a/src/main/java/org/spigotmc/WatchdogThread.java
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
@@ -52,7 +52,7 @@ public class WatchdogThread extends Thread
while ( !stopping )
{
//
- if ( lastTick != 0 && System.currentTimeMillis() > lastTick + timeoutTime )
+ if ( lastTick != 0 && System.currentTimeMillis() > lastTick + timeoutTime && !Boolean.getBoolean("disable.watchdog")) // Paper - Add property to disable
{
Logger log = Bukkit.getServer().getLogger();
log.log( Level.SEVERE, "The server has stopped responding!" );
--
2.8.2