[ https://issues.apache.org/jira/browse/SLING-4806?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Konrad Windszus updated SLING-4806: ----------------------------------- Description: Currently all {{DynamicClassLoaderManagers}} become invalid if # a new bundle has been started which provides packages which have been previously unresolvable by any of the {{DynamicClassLoader}} s or if # a bundle is no longer active which used to provide at least one class being loaded through one of the {{DynamicClassLoader}} s. In that case the {{DynamicClassLoaderManagerFactory}} is first unregistered and then reregistered (https://github.com/apache/sling/blob/trunk/bundles/commons/classloader/src/main/java/org/apache/sling/commons/classloader/impl/Activator.java#L134) The whole refresh logic is IMHO only necessary because the JRE caches all classes being requested through a classloader. The invalidation could be improved by only reregistering those {{DynamicClassLoaderManagers}} which have been used to # load a class which was not available in the past but may be now available (due to a new bundle) # load a class which was provided through a bundle which is now no longer being available was: Currently all {{DynamicClassLoaderManagers}} become invalid if # a new bundle has been started which provides packages which have been previously unresolvable by any of the {{DynamicClassLoader}}s or if # a bundle is no longer active which used to provide at least one class being loaded through one of the {{DynamicClassLoader}}s. In that case the {{DynamicClassLoaderManagerFactory}} is first unregistered and then reregistered (https://github.com/apache/sling/blob/trunk/bundles/commons/classloader/src/main/java/org/apache/sling/commons/classloader/impl/Activator.java#L134) The whole refresh logic is IMHO only necessary because the JRE caches all classes being requested through a classloader. The invalidation could be improved by only reregistering those {{DynamicClassLoaderManagers}} which have been used to # load a class which was not available in the past but may be now available (due to a new bundle) # load a class which was provided through a bundle which is now no longer being available > Only invalidate those DynamicClassLoaderManagers which are becoming invalid > --------------------------------------------------------------------------- > > Key: SLING-4806 > URL: https://issues.apache.org/jira/browse/SLING-4806 > Project: Sling > Issue Type: Improvement > Components: Commons > Affects Versions: Commons ClassLoader 1.3.2 > Reporter: Konrad Windszus > Attachments: SLING-4806-notworking.patch > > > Currently all {{DynamicClassLoaderManagers}} become invalid if > # a new bundle has been started which provides packages which have been > previously unresolvable by any of the {{DynamicClassLoader}} s or if > # a bundle is no longer active which used to provide at least one class being > loaded through one of the {{DynamicClassLoader}} s. > In that case the {{DynamicClassLoaderManagerFactory}} is first unregistered > and then reregistered > (https://github.com/apache/sling/blob/trunk/bundles/commons/classloader/src/main/java/org/apache/sling/commons/classloader/impl/Activator.java#L134) > The whole refresh logic is IMHO only necessary because the JRE caches all > classes being requested through a classloader. > The invalidation could be improved by only reregistering those > {{DynamicClassLoaderManagers}} which have been used to > # load a class which was not available in the past but may be now available > (due to a new bundle) > # load a class which was provided through a bundle which is now no longer > being available -- This message was sent by Atlassian JIRA (v6.3.4#6332)