[java] Explicitly closing the URLClassLoader of the JrtFileSystemProvider
This commit is contained in:
@ -248,6 +248,14 @@ public class ClasspathClassLoader extends URLClassLoader {
|
||||
public void close() throws IOException {
|
||||
if (fileSystem != null) {
|
||||
fileSystem.close();
|
||||
// jrt created an own classloader to load the JrtFileSystemProvider class out of the
|
||||
// jrt-fs.jar. This needs to be closed manually.
|
||||
ClassLoader classLoader = fileSystem.getClass().getClassLoader();
|
||||
if (classLoader instanceof URLClassLoader) {
|
||||
((URLClassLoader) classLoader).close();
|
||||
}
|
||||
packagesDirsToModules = null;
|
||||
fileSystem = null;
|
||||
}
|
||||
super.close();
|
||||
}
|
||||
|
Reference in New Issue
Block a user