Duplicate :
|
|
Relates :
|
|
Relates :
|
This is a special case of of 4950148 which is arguably worth handling separately. The problems of closing a ClassLoader are understood and described in 4950148. However, until that bug is fixed, it would be useful to have URLClassLoader implement Closeable and close() with a more limited specification that it should close any open JarFiles which it is using. If and when ClassLoader itself implements Closeable, then URLClassLoader.close() can call super.close() to have all the right additional things happen. See 6558476 for a problem reported against javac, which boils down to the same problem. Currently, the proposed fix for javac is to try and use reflection to access the private fields containing the jar files in order to close them. It would be better if URLClassLoader provided that functionality directly.
|