use of org.mule.runtime.module.artifact.api.classloader.DisposableClassLoader in project mule by mulesoft.
the class DefaultMuleApplication method dispose.
@Override
public void dispose() {
// classloader cleanup
try {
ClassLoader appCl = null;
if (getArtifactClassLoader() != null) {
appCl = getArtifactClassLoader().getClassLoader();
}
// if not initialized yet, it can be null
if (appCl != null) {
Thread.currentThread().setContextClassLoader(appCl);
}
doDispose();
if (appCl != null) {
if (isRegionClassLoaderMember(appCl)) {
((DisposableClassLoader) appCl.getParent()).dispose();
} else if (appCl instanceof DisposableClassLoader) {
((DisposableClassLoader) appCl).dispose();
}
}
} finally {
// kill any refs to the old classloader to avoid leaks
Thread.currentThread().setContextClassLoader(null);
deploymentClassLoader = null;
}
}
Aggregations