Maxim Karvonen wrote:What happens with TranslationPlugins loaded by getPlugin method?
The instances are used briefly, and then discarded.
I did finally find the issue which was causing the problem. I ignored a warning for line #95 (
ClassLoader classLoader = new URLClassLoader(urls, parentClassLoader);), stating:
Resource Leak 'classLoader' is never closed. It turns-out this actually needed to be addressed - because the class loader would never unload as long as there was a dangling reference.
Since there is no ClassLoader method to explicitly close it, I changed my class loader object to be an instance of URLClassLoader (which implements AutoCloseable), and used a
try-with-resources statement to instantiate the class loader object (
try (URLClassLoader classLoader = new URLClassLoader(urls, parentClassLoader)) { ... }), so that it would be automatically closed at the end of the block. It worked!
My next step is to clean-up what I have done, and add a directory watcher
thread to automatically register and de-register plug-ins as they are added/removed/replaced.
Ron