Use of pass-by-reference through "noLocalCopies = true" requires careful consideration as it violates the EJB specification
 Technote (troubleshooting)
 
Problem(Abstract)
Many WebSphere® Application Server customers use the noLocalCopies = true" property to improve performance. This is a willful violation of the EJB™ specification and can have serious ramifications in customer applications.
 
Resolving the problem
WebSphere Application Server customers choosing to use the noLocalCopies = true property must be made aware of the potential ramifications.
Section 5.4 of the 2.0 EJB Specification states:

"... Remote calls involve pass-by-value. This copy semantics provides a layer of isolation between caller and callee, and protects against the inadvertent modification of data. The client and the bean may be programmed to assume this parameter copying."

This requires serious consideration.

The EJB specification violation mentioned above is entirely related to the use of noLocalCopies = true and is not related to how an application is coded. Java™ uses pass-by-reference by design. However, as stated above, the EJB specification requires pass-by-value for remote calls. The object request broker (ORB) brings applications using WebSphere into compliance by creating local copies of passed parameters.

Setting noLocalCopies to true improves performance because it bypasses the creation of these local copies; however, it is also a willful violation of the EJB specification. If noLocalCopies = true is used, one must exercise additional care to ensure that the application is not negatively impacted by using pass-by-reference semantics. For example, if one bean passes another bean an object, expecting that the second bean can modify the object without affecting the first bean's object.
 
 
Cross Reference information
Segment Product Component Platform Version Edition
Application Servers Runtimes for Java Technology Java SDK
 
 


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server > EJB Container
Operating system(s): Windows
Software version: 6.0
Software edition:
Reference #: 1177846
IBM Group: Software Group
Modified date: Aug 25, 2004