Skip to content

Commit

Permalink
Stop the FileWatcher when unloading configs.
Browse files Browse the repository at this point in the history
The FileWatcher needs to be stopped somewhere otherwise the jvm will hang on exit because it is keeping a ScheduledExecutorService thread pool alive with non-daemon threads. Since ConfigTracker.unloadConfigs is called during server stop, it seems like an ok place to also stop the FileWatcher.
  • Loading branch information
LeadAssimilator authored Dec 14, 2024
1 parent b4a1040 commit 25d5c05
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ public void loadConfigs(ModConfig.Type type, Path configBasePath, @Nullable Path
public void unloadConfigs(ModConfig.Type type) {
LOGGER.debug(CONFIG, "Unloading configs type {}", type);
this.configSets.get(type).forEach(ConfigTracker::closeConfig);
if (!FMLConfig.getBoolConfigValue(FMLConfig.ConfigValue.DISABLE_CONFIG_WATCHER)) {
FileWatcher.defaultInstance().stop();
}
}

static void openConfig(ModConfig config, Path configBasePath, @Nullable Path configOverrideBasePath) {
Expand Down

0 comments on commit 25d5c05

Please sign in to comment.