This is not a definitive answer since I have not looked at the JBoss code for this, but in my testing I have found that whether I am using LocalHome or RemoteHome to access EJBs on the same server that the performance is that same, so my guess is that JBoss does perform "magic" under the covers. Also, I vaguely recall someone from JBoss mentioning that this was the case.
Thanks for your reply...I going through looking at the stactraces...probably..you are right ..there is no big difference..but it is worth taking a look!
??! eventually indeed JBoss does the magic! No RMI calls event if all the EJBS are declared only with Remote Interface!
Though ok I have to say that probably there is some kind of difference when it comes to CPU cycles on perfoming or not perfoming remote calls!
Anyway the problem started with an application deployed on JBoss 4.0.0 where it had only -remote- EJBs and perfomed only remote calls and in a similar application in JBoss 4.0.2 where again it had again only remote EJBs but it was perfoming loca calls (we are talking to single VM apps..both).
So after a tip dropped from a JBoss Developer D.Andreadis we had a look on
and thembean code="org.jboss.naming.NamingService" name="jboss:service=Naming" xmbean-dd="resource:xmdesc/NamingService-xmbean.xml"> <!-- The call by value mode. true if all lookups are unmarshalled using the caller's TCL, false if in VM lookups return the value by reference. --> <attribute name="CallByValue">false</attribute>
<!-- EAR deployer, remove if you are not using ear deployments --> <mbean code="org.jboss.deployment.EARDeployer" name="jboss.j2ee:service=EARDeployer"> <attribute name="Isolated">false</attribute> <!-- A flag indicating if the ear components should have in VM call optimization disabled. --> <attribute name="CallByValue">false</attribute>
On JBoss 4.0.0 these settings are set to true so JBoss wont perform any magic at all!
On Jboss 4.0.2 and on...these are set to false so ..it behaves very clever detacting all the local calls.
so watch out if you are have not noticed these settings...