diff options
author | Sebastian Lövdahl <slovdahl@hibox.fi> | 2024-02-20 09:16:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-20 09:16:09 +0200 |
commit | b92ec9ed53f69638c9726c29bc25a780a8eb7a17 (patch) | |
tree | 2ed482861cd85536e76dc8409e22722ccae015d8 /pf4j/src/main | |
parent | 5a73e6a1b3d45167281c806e06bfeb0fcd1bdb25 (diff) | |
download | pf4j-b92ec9ed53f69638c9726c29bc25a780a8eb7a17.tar.gz pf4j-b92ec9ed53f69638c9726c29bc25a780a8eb7a17.zip |
Post `PluginState.UNLOADED` event when plugins are unloaded (#567)
Diffstat (limited to 'pf4j/src/main')
-rw-r--r-- | pf4j/src/main/java/org/pf4j/AbstractPluginManager.java | 1 | ||||
-rw-r--r-- | pf4j/src/main/java/org/pf4j/PluginState.java | 11 |
2 files changed, 10 insertions, 2 deletions
diff --git a/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java b/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java index f3a7231..78c261c 100644 --- a/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java +++ b/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java @@ -311,6 +311,7 @@ public abstract class AbstractPluginManager implements PluginManager { } // remove the plugin + pluginWrapper.setPluginState(PluginState.UNLOADED); plugins.remove(pluginId); getResolvedPlugins().remove(pluginWrapper); getUnresolvedPlugins().remove(pluginWrapper); diff --git a/pf4j/src/main/java/org/pf4j/PluginState.java b/pf4j/src/main/java/org/pf4j/PluginState.java index 989157f..6a6c1f9 100644 --- a/pf4j/src/main/java/org/pf4j/PluginState.java +++ b/pf4j/src/main/java/org/pf4j/PluginState.java @@ -20,7 +20,7 @@ package org.pf4j; * <p> * Lifecycle of a plugin: * <pre> - * CREATED -> RESOLVED -> STARTED -> STOPPED + * CREATED -> RESOLVED -> STARTED -> STOPPED -> UNLOADED * CREATED -> DISABLED * CREATED -> FAILED * @@ -57,7 +57,14 @@ public enum PluginState { /** * Plugin failed to start. */ - FAILED("FAILED"); + FAILED("FAILED"), + + /** + * The plugin has been unloaded. After this event has been completed, the plugin's + * {@link ClassLoader} will be closed. + */ + UNLOADED("UNLOADED"), + ; private final String status; |