dlmarion commented on PR #39:
URL:
https://github.com/apache/accumulo-classloaders/pull/39#issuecomment-3749493026
> Why do you want a cleaner for the classloader?
The `URLClassLoader.close` calls close on any open streams(1) and any open
jar files(2).
1. InputStreams to jar files are returned from
URLClassLoader.getResourceAsStream. In theory, the caller would close the Input
Stream when it's done, but the close method also tries to close them.
2. The URLClassLoader has a list of Loader objects and each Loader has a
reference to a JarFile that may have open InputStreams and Inflater objects.
However, looking at the code this morning, JarFile registers its own Cleaner
down in ZipFile.CleanableResource.
If JarFile has it's own cleaner, then do we need to close any InputStreams
that may be open from calls to `URLClassLoader.getResourceAsStream`? Would an
unclosed InputStream be a resource leak? Would it retain a handle to the file
descriptor such that when the file is deleted that the space would not be
reclaimed?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]