Skip to content

Commit

Permalink
Mark bStats threads as daemon
Browse files Browse the repository at this point in the history
Fixes #123
  • Loading branch information
C0D3-M4513R authored Jul 28, 2024
1 parent 6660b2b commit e8d3b1c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion base/src/main/java/org/bstats/MetricsBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,11 @@ public MetricsBase(
boolean logSentData,
boolean logResponseStatusText) {
ScheduledThreadPoolExecutor scheduler = new ScheduledThreadPoolExecutor(1,
task -> new Thread(task, "bStats-Metrics"));
task -> {
Thread thread = new Thread(task, "bStats-Metrics");
thread.setDaemon(true);
return thread;
});
// We want delayed tasks (non-periodic) that will execute in the future to be
// cancelled when the scheduler is shutdown.
// Otherwise, we risk preventing the server from shutting down even when
Expand Down

0 comments on commit e8d3b1c

Please sign in to comment.