mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 00:15:44 +01:00
Remove function creep
This commit is contained in:
@@ -58,6 +58,8 @@ import sonia.scm.util.IOUtil;
|
||||
import javax.inject.Inject;
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.ServletContextEvent;
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -77,7 +79,7 @@ public class ScmContextListener extends GuiceResteasyBootstrapServletContextList
|
||||
private final ClassLoader parent;
|
||||
private final Set<PluginWrapper> plugins;
|
||||
private Injector injector;
|
||||
|
||||
|
||||
public interface Factory {
|
||||
ScmContextListener create(ClassLoader parent, Set<PluginWrapper> plugins);
|
||||
}
|
||||
@@ -183,6 +185,18 @@ public class ScmContextListener extends GuiceResteasyBootstrapServletContextList
|
||||
}
|
||||
|
||||
super.contextDestroyed(servletContextEvent);
|
||||
|
||||
for (PluginWrapper plugin : getPlugins()) {
|
||||
ClassLoader pcl = plugin.getClassLoader();
|
||||
|
||||
if (pcl instanceof Closeable) {
|
||||
try {
|
||||
((Closeable) pcl).close();
|
||||
} catch (IOException ex) {
|
||||
LOG.warn("could not close plugin classloader", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void closeCloseables() {
|
||||
@@ -205,6 +219,4 @@ public class ScmContextListener extends GuiceResteasyBootstrapServletContextList
|
||||
private void destroyServletContextListeners(ServletContextEvent event) {
|
||||
injector.getInstance(ServletContextListenerHolder.class).contextDestroyed(event);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -112,20 +112,6 @@ public class BootstrapContextListener implements ServletContextListener {
|
||||
public void contextDestroyed(ServletContextEvent sce) {
|
||||
contextListener.contextDestroyed(sce);
|
||||
|
||||
if (contextListener instanceof ScmContextListener) {
|
||||
for (PluginWrapper plugin : ((ScmContextListener) contextListener).getPlugins()) {
|
||||
ClassLoader pcl = plugin.getClassLoader();
|
||||
|
||||
if (pcl instanceof Closeable) {
|
||||
try {
|
||||
((Closeable) pcl).close();
|
||||
} catch (IOException ex) {
|
||||
logger.warn("could not close plugin classloader", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
context = null;
|
||||
contextListener = null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user