Skip to content

Commit

Permalink
[core] Add kill switch for dead plugin sets (#686)
Browse files Browse the repository at this point in the history
JVM property `dicoogle.deadPluginKillSwitch`.
If true, any dead plugin will kill the process
  • Loading branch information
Enet4 committed Apr 24, 2024
1 parent ea2e9e2 commit 471e530
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ public synchronized static PluginController getInstance() {
private TaskManager taskManagerQueries =
new TaskManager(Integer.parseInt(System.getProperty("dicoogle.taskManager.nQueryThreads", "4")));

/** Whether to shut down Dicoogle when a plugin is marked as dead */
private static boolean DEAD_PLUGIN_KILL_SWITCH =
System.getProperty("dicoogle.deadPluginKillSwitch", "false").equalsIgnoreCase("true");

public PluginController(File pathToPluginDirectory) {
logger.info("Creating PluginController Instance");
Expand Down Expand Up @@ -172,9 +175,14 @@ private void configurePlugins() {
logger.warn("Plugin set name cannot be retrieved: {}", ex2.getMessage());
name = "UNKNOWN";
}
logger.error("Unexpected error while loading plugin set {}. Plugin set marked as dead.", name, e);
this.deadPluginSets.add(new DeadPlugin(name, e));
it.remove();
if (DEAD_PLUGIN_KILL_SWITCH) {
logger.error("Unexpected error while loading plugin set {}. Dicoogle will shut down.", name, e);
System.exit(-4);
} else {
logger.error("Unexpected error while loading plugin set {}. Plugin set marked as dead.", name, e);
this.deadPluginSets.add(new DeadPlugin(name, e));
it.remove();
}
}
}
logger.debug("Settings pushed to plugins");
Expand Down

0 comments on commit 471e530

Please sign in to comment.