dev@glassfish.java.net

Re: [v3] exporting all Metro packages for OSGi

From: Craig L Russell <Craig.Russell_at_Sun.COM>
Date: Thu, 21 Aug 2008 15:23:05 -0700

On Aug 21, 2008, at 2:18 PM, Bill Shannon wrote:

> Craig L Russell wrote:
>> The only way ServiceLoader can load the class is to do a
>> getResource("META-INF/foo") from a ClassLoader that has the jar in
>> its resource path.
>> So it makes sense to me that ServiceLoader should use the same
>> ClassLoader for both getResource("META-INF/foo") and
>> loadClass("com.sun.fooservice.Foofactory").
>
> I guess I need to understand exactly what the JVM module support
> would control.
>
> Today it's true that I can request that private classes be loaded
> in another class loader, even though I won't be able to use the class
> once its loaded. I suppose the same could be true for module-private
> classes.
>
> But doesn't ServiceLoader need to instantiate an instance of the
> class?
> Would it be able to do that if the class were private (in a way that
> the JVM enforced)?

Yes, after loadClass, it needs to construct an instance of the class.
ServiceLoader presumably has permissions to use methods getResource
and loadClass and then newInstance on the class it just loaded.

I don't know the details of Modules, but does it not anticipate that
some system classes need to manipulate class loaders? How is OSGi
itself able to be implemented if the system is nailed shut?

Craig
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>

Craig L Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell_at_sun.com
P.S. A good JDO? O, Gasp!