Richard S. Hall wrote:
Upayavira wrote:
But if that MyHost code is running within a bundle, surely it would
use Felix's classloader?
Yes, I stated that.
What scenarios are there under which an app running in an OSGi
container would _not_ use the Felix classloader? That is, without the
Felix Classlaoder being somewhere in the classloader chain?
We are talking at cross purposes, I think. I all code to be loaded is
inside of a bundle, then we will potentially get to intercept the class
load call for URL.class, unless they do something like create their own
class loader (which uses the system class loader as its parent by
default) or just simply directly uses the system class loader.
However, I thought you were also referring to the generic case, where
you have a host application that creates an instance of Felix...in that
case there is nothing you can do.
No matter, there is still no way to guarantee that everyone uses your
class loader even inside a bundle, because the system class loader is
always accessible.
Okay. What I have in mind is that, outside of OSGi, they can do what
they like - talk to the System classloader, etc. Inside of OSGi, we do
what _we_ like, i.e. override the standard URL class as necessary. That
way, a Felix app can run alongside another app in a container when both
set StreamHandlers. But the non-OSGi app wouldn't need to know anything
about OSGi's stream handlers, in fact, much better that it doesn't.
Make sense now? :-)
Regards, Upayavira