Release detached plugin class loaders on shutdown (#6034)

This commit is contained in:
Basil Crow authored and GitHub committed 2021-12-14 08:27:50 +00:00
1 parent 91675c5d44
commit 560136b534
1 file changed
+6 -2
+6 -2
View File
@@ -1327,12 +1327,16 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
/**
* Orderly terminates all the plugins.
*/
public void stop() {
public synchronized void stop() {
for (PluginWrapper p : activePlugins) {
p.stop();
}
List<PluginWrapper> pluginsCopy = new ArrayList<>(plugins);
for (PluginWrapper p : pluginsCopy) {
activePlugins.remove(p);
plugins.remove(p);
p.releaseClassLoader();
}
activePlugins.clear();
// Work around a bug in commons-logging.
// See http://www.szegedi.org/articles/memleak.html
LogFactory.release(uberClassLoader);