dev@glassfish.java.net

Re: osgi question

From: Justin Lee <justin.d.lee_at_oracle.com>
Date: Wed, 19 May 2010 09:08:05 -0400

In my asadmin command, I'm passed a class name. I'd like to load that
class by name and make sure it implements an interface. But I'm not
sure how to do that in such a way that I don't cause a leak of some sort
by loading a class into the wrong classloader. Right now I'm using the
context classloader but apparently that's not the right way either.

On 5/18/10 6:18 PM, Richard S. Hall wrote:
> On 5/18/10 14:14, Justin Lee wrote:
>> But while we're on the subject, I need to verify that the given class
>> name (passed as a string to the asadmin command) correctly implements
>> the proper interfaces. As i understand it, Class.forName() is
>> considered harmful in an OSGi environment and as I recall we should
>> use something Thread.currentThread().getContextClassLoader() is that
>> correct?
>
> Context class loader is not really used in OSGi.
>
> How are you expecting to get this class? Does your bundle import the
> package? Is it a dynamic import? I think I need more details on your
> scenario.
>
> -> richard
>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>