aboutsummaryrefslogtreecommitdiffstats
path: root/pf4j
diff options
context:
space:
mode:
authorDecebal Suiu <decebal.suiu@gmail.com>2019-04-15 20:28:30 +0300
committerDecebal Suiu <decebal.suiu@gmail.com>2019-04-15 20:28:30 +0300
commit3199b5f043ad533429b7834ce06e9d4129e6b596 (patch)
treee751071e358fc284db42712ecf2121d67ebb35ed /pf4j
parent40846fa1864da287690ef01402d5b5ccccbf351f (diff)
downloadpf4j-3199b5f043ad533429b7834ce06e9d4129e6b596.tar.gz
pf4j-3199b5f043ad533429b7834ce06e9d4129e6b596.zip
Resolve #309
Diffstat (limited to 'pf4j')
-rw-r--r--pf4j/src/main/java/org/pf4j/AbstractPluginManager.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java b/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java
index 33130a3..3833588 100644
--- a/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java
+++ b/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java
@@ -287,19 +287,25 @@ public abstract class AbstractPluginManager implements PluginManager {
checkPluginId(pluginId);
PluginWrapper pluginWrapper = getPlugin(pluginId);
+ // stop the plugin if it's started
PluginState pluginState = stopPlugin(pluginId);
if (PluginState.STARTED == pluginState) {
log.error("Failed to stop plugin '{}' on delete", pluginId);
return false;
}
+ // get an instance of plugin before the plugin is unloaded
+ // for reason see https://github.com/pf4j/pf4j/issues/309
+ Plugin plugin = pluginWrapper.getPlugin();
+
if (!unloadPlugin(pluginId)) {
log.error("Failed to unload plugin '{}' on delete", pluginId);
return false;
}
+ // notify the plugin as it's deleted
try {
- pluginWrapper.getPlugin().delete();
+ plugin.delete();
} catch (PluginException e) {
log.error(e.getMessage(), e);
return false;