Hello all,

I have a ClassLoading issue with my bundles and I hope you can help me solve
it.

The problem is that I have two versions of a bundle ( let's name them A and
A' ) exposing some services to other bundles in the application. Both
versions have quite identical classes except for bundle A having some extra
profiling code in all of its classes compared bundle A. Each bundle A or A'
shares instances from its classes with other bundles either through service
hooks or through explicit export- and import-package constructs.

The problem I am facing is that when I swap A with A', the objects shared as
OSGi services get swapped as expected, however the classes shared through
explicit import and export constructs don't get swapped. Explicitly said,
some of the classes from A remain loaded and accessible to classes in other
bundles through the defining class loader that for the first time loads
those classes. However, classes providing a service are swapped as a matter
of replacing A with A'.

I believe this is mainly because the defining loader that initially loads
classes from A remains reachable by some other bundles in the application.
However, it seems very difficult for me to detect which bundles are holding
references and to which classes from the initially loaded classes in A. I
wonder if there is any way to explicitly enforce the initially loaded
classes to get garbage collected so that every single time I swap A and A',
I get proper wiring for classes in each bundle as expected.

I would very much appreciate any help or hint,
-Nima

-- 
http://nima.magic.ubc.ca

Reply via email to