*sigh* ah, whatever.  And I though I understood classloading.

Tom

On Mon, 19 Feb 2001, you wrote:
> No.  
> 
> Object o = ctx.lookup( "my_home_interface" );
> my.home.interface mhi = (my.home.interface)o;
> 
> When I said RMI classloading, I am talking about what happens in
> MarshalledObject.get().  When RMI goes to deserialize an object, it needs to
> load the class, and it uses ContextClassLoader for that.  Which means that
> the instance of the class that you get returned to you is loaded by the
> right class loader. 
> 
> In this code there are 2 (or 3) classloading operations going on.  When you
> call ctx.lookup, your class is being loaded by RMI, probably using the
> context classloader, in an explicit CL.loadClass() call.  When you use a
> class name as a symbol in your code (in a variable declaration, in a cast,
> in a .Class operation) an implicit classload is performed by the JVM,
> because that symbol is translated by the jvm into a class object.  The
> implicit classload uses the defining classloader of the class that the JVM
> is currently executing.  So would a Class.forName.
> 
> In other words, the JVM NEVER uses ContextClassLoader for default
> classloading.  It is only used when explicit call is made to
> Thread.currentThread().getContextClassLoader().loadClass(x).  However, some
> standard classes, like java.rmi.MarshalledObject, use it in that way, so it
> can be useful under certain circumstances.  It is also a convenient way to
> keep track of a classloader that you want all your classes to use without
> passing it through every method call - Jboss uses it that way fairly often.


--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
List Help?:          [EMAIL PROTECTED]

Reply via email to