Well, it appears to not work at all.
Here is what I was thinking of:
http://docs.sun.com/app/docs/doc/820-4337/beavo?a=view
It's the pass-by-reference element of the sun-application.xml file.
According to that page, it says:
"Specifies the passing method used by a servlet or enterprise bean calling a remote interface method in another bean that is colocated within the same [b]process[/b]."
Now, [b]process[/b] is not the same thing as EAR (at least IMHO). But regardless of how I set it, I could not seem to get it to work across EARs.
The way I tested it was I had 3 components. A Servlet, calling an EJB, which called another EJB. The interfaces were in a library jar. All of the calls were with the same simple object.
I had each method along the way modify the passed object in place.
Also, I made the object Externalizable with some println's so I could "see" if the object was being serialized.
Each EJB was in its own EAR, and I deployed all 3 components.
Regardless of the setting of pass-by reference, in any of the 2 EJBs, the object was serialized. Now, I expected the Servlet call to the first EJB to be serialized (since you can't speficy a sun-application.xml file for a simple war, you'd have to bundle it in an EAR, which I did not do). But the call from the first EJB to the second should NOT have been serialized, if the documentation was correct about inter-process calls, and the parameter was being honored.
But that didn't happen.
So, I bundled everything (WAR, and 2 EJBs) in to a single EAR, and fired it off.
In this case, the object was NEVER serialized (at least, my Externalizable routines were never called).
However, some kind of copy was happening since there were no side effects propagated back up to the callers.
Note, even when I specifically set the pass-by-reference parameter to FALSE in the combined EAR, my objects were not serialized. Obviously serialization is not the only way to copy an object.
Using System.hashIdentity, all of the objects in each of the methods had a different value, which tells me they were different objects.
Of course, it DOES say that you can not rely on side effects
I also added a Local EJB, and that is clearly using the same object, System.hashIdentity was the same in the source method and within the destination method.
So, anyway, it seems to be doing different things. At a minimum, "pass-by-reference" doesn't seem to have any affect whatsoever.
Oh, that this is all on GF v2 (Sun Java System Application Server 9.1_02 (build b04-fcs))
[Message sent by forum member 'whartung' (redrocks_at_sbcglobal.net)]
http://forums.java.net/jive/thread.jspa?messageID=365630