Browse Source

Fix for problem with file lock on Windows platform. Introduce unloadPlugins method. (#387)

Thanks for your contribution!
pull/388/head
Valeriy Kucherenko 4 years ago committed by GitHub
parent
commit
58d3c8e183
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      pf4j/src/main/java/org/pf4j/AbstractPluginManager.java
  2. 5
      pf4j/src/main/java/org/pf4j/PluginManager.java
  3. 2
      pf4j/src/test/java/org/pf4j/JarPluginManagerTest.java

11
pf4j/src/main/java/org/pf4j/AbstractPluginManager.java

@ -235,6 +235,17 @@ public abstract class AbstractPluginManager implements PluginManager {
}
}
/**
* Unload all plugins
*/
@Override
public void unloadPlugins() {
// wrap resolvedPlugins in new list because of concurrent modification
for (PluginWrapper pluginWrapper : new ArrayList<>(resolvedPlugins)) {
unloadPlugin(pluginWrapper.getPluginId());
}
}
/**
* Unload the specified plugin and it's dependents.
*/

5
pf4j/src/main/java/org/pf4j/PluginManager.java

@ -100,6 +100,11 @@ public interface PluginManager {
*/
PluginState stopPlugin(String pluginId);
/**
* Unload all plugins
*/
void unloadPlugins();
/**
* Unload a plugin.
*

2
pf4j/src/test/java/org/pf4j/JarPluginManagerTest.java

@ -53,6 +53,8 @@ public class JarPluginManagerTest {
@AfterEach
public void tearDown() {
pluginManager.unloadPlugins();
pluginJar = null;
pluginManager = null;
}

Loading…
Cancel
Save