hansva opened a new issue, #9148: URL: https://github.com/apache/hop/issues/9148
### What needs to happen? ### Problem While registering plugins at startup, `BasePluginType.registerPluginJars()` calls `createUrlClassLoader()` once for **every annotated class** in a plugin jar, not once per jar. Each call: - creates a new `HopURLClassLoader` that is never closed, so its jar files stay open; - lists the plugin's `lib/` folder again, and parses its `dependencies.xml` again, with a new XML parser factory each time; - starts with an empty `ResourceBundle` cache, so the translations of a plugin are read again for every class in the same jar. A Hop installation has ~650 annotated plugin classes in ~300 plugin jars, so this happens hundreds of times at every start: in `hop-run`, Hop GUI, `hop-conf` and the other tools. It is one reason startup got slower and used more memory as plugins were added. ### Proposed fix Share one scan class loader per plugin jar, cached in `JarCache`. The cache key is the jar, the parent class loader and the plugin type class that builds the loader, so plugin types that override `createUrlClassLoader()` keep their own loaders. The plugins' real class loaders are created later by `PluginRegistry`, from the plugin's libraries, so what plugins run with doesn't change. ### Measured - **−251 ms** - **peak memory −52 MB** ### Issue Priority Priority: 2 ### Issue Component Component: API -- 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]
