Skip to content

Commit

Permalink
Stop FileWatcher default instance on dedicated server exit
Browse files Browse the repository at this point in the history
This prevents the FileWatcher instance from blocking the JVM from
exiting normally, as the instance keeps alive a non-daemon thread (and
the JVM waits on all non-daemon threads to exit).

Fixes #1626
  • Loading branch information
sciwhiz12 committed Dec 11, 2024
1 parent ac0abaf commit c472ab2
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,17 @@
return true;
}
}
@@ -277,6 +_,10 @@
@@ -277,6 +_,13 @@
if (this.queryThreadGs4 != null) {
this.queryThreadGs4.stop();
}
+ if (this.dediLanPinger != null) {
+ this.dediLanPinger.interrupt();
+ this.dediLanPinger = null;
+ }
+
+ // Neo: Forcibly stop the FileWatcher default instance, to prevent it from blocking normal JVM exit; see #1626
+ com.electronwill.nightconfig.core.file.FileWatcher.defaultInstance().stop();
}

@Override
Expand Down

0 comments on commit c472ab2

Please sign in to comment.