I was under the impression that because in OSGi each bundle has its own class
loader, static variables are initialized once per classloader.

When I try to instantiate class A from bundle A in bundle B, static
variables are left over from initialization when class was loaded in bundle
A.

Classloaders are indeed different for class A instantiated in bundle A and
bundle B.

The reason I am doing this is because I need a “context” per bundle that is
used by common code exported by bundle A and used by other bundles, and I
don’t want to drag that “context” all over the place and pass it to every
call.

So my question is: is there any static way of  doing this?

Thanks

--
View this message in context: 
http://karaf.922171.n3.nabble.com/Static-variables-tp3287037p3287037.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Reply via email to