Running the integrated jboss with tomcat, I noticed that I was getting a lot
of serialization going on, so I started digging through the code to find out
what was going on.  After looking at it for a long time, however, I dont
understand how (using an ear file) the optimized code could ever run between
ejb jars and war files.  Im hoping that someone can explain this to me.
line numbers are from most recent snapshot, but the code is essentially the
same in 2.0 FINAL

In org/jboss/ejb/plugins/jrmp/server/JRMPContainerInvoker.java is the code
that determines whether or not we will run optimized: (line 419 for the
invoke function)

      if
(!m.getDeclaringClass().isAssignableFrom(((ContainerInvokerContainer)contain
er).getRemoteClass()))

(then serialize, otherwise don't serialize)

Or line 382 for the invokeHome function, same thing except with home
interface.

which makes sense - if the class being returned isnt assignable locally,
then wed better serialize.  Since the class is the same in both cases (ie.
the ejb home or remote interface), the key is whether they were loaded by
the same classloader.  The local class was loaded by the calling
ejb/servlet(tomcat), the remote by the ejb being called.  

Here's why I dont see how this can ever work.  every ejb has its own
classloader, which is created in org/jboss/ejb/ContainerFactory.java (line
331), and which sees only the ejb-jar file for that ejb.  and the web
context has a different classloader, which is created in
org/jboss/deployment/J2eeDeployer.java (line 589), and which sees all of the
ejb jars for the entire application.  since every component has its own
classloader it seems as though the serialization would be necessary in all
calls between components.

Hopefully at this point someone will tell me Im an idiot and explain why the
optimization works fine.  Im assuming this will happen because people have
said that they have made the optimized code work.  If I am right, I dont
really see any way to fix it, except by passing the j2ee classloader to all
the ejb containers as well as to tomcat, so that everyone will see the same
classloader.  This would mean that the individual ejb-jars would see each
others code, instead of each jar just seeing the classes that it contains.


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

Reply via email to