Sun Java System Application Server Enterprise Edition 8.2 Developer's Guide

pass-by-reference

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 process.


Note –

The pass-by-reference element only applies to remote calls. As defined in the EJB 2.1 specification, section 5.4, calls to local interfaces use pass-by-reference semantics.

If the pass-by-reference element is set to its default value of false, the passing semantics for calls to remote interfaces comply with the EJB 2.1 specification, section 5.4. If set to true, remote calls involve pass-by-reference semantics instead of pass-by-value semantics, contrary to this specification.

Portable programs cannot assume that a copy of the object is made during such a call, and thus that it’s safe to modify the original. Nor can they assume that a copy is not made, and thus that changes to the object are visible to both caller and callee. When this element is set to true, parameters and return values should be considered read-only. The behavior of a program that modifies such parameters or return values is undefined.


When a servlet or enterprise bean calls a remote interface method in another bean that is colocated within the same process, by default the Application Server makes copies of all the call parameters in order to preserve the pass-by-value semantics. This increases the call overhead and decreases performance.

However, if the calling method does not change the object being passed as a parameter, it is safe to pass the object itself without making a copy of it. To do this, set the pass-by-reference value to true.

The setting of this element in the sun-application.xml file applies to all EJB modules in the application. For an individually deployed EJB module, you can set the same element in the sun-ejb-jar.xml file. If pass-by-reference is used at both the bean and application level, the bean level takes precedence.

Superelements

sun-application (sun-application.xml), ejb (sun-ejb-jar.xml)

Subelements

none - contains data