The GlassFish ORB does indeed support short-circuit invocation of remote reference
when they are in the same VM (and using the same ORB, which should normally be the
case in GlassFish) as the invoker. The serialization
code in one of the stack traces is due to the object copier being used to preserve call-by-value
semantics (which is required by the specs). Normally we use a fast reflective copier, but as you
can see in the stack trace, that did not work in this case, so we failed over to the
ORB stream copier, which is almost as slow as a remote invocation (just no transport overhead).
You can tell the stack trace is the short-circuit case because of the call to
DynamicMethodMarshaller.copyObject, which only happens in the short-circuit (co-located)
case.
The ORB also support pass-by-reference using a trivial (identity) object copier.
However, I have no idea why that is not being used in this case. I'll forward this
discussion to Mahesh, who knows the EJB layer very well.
[Message sent by forum member 'kcavanaugh' (kcavanaugh)]
http://forums.java.net/jive/thread.jspa?messageID=261671