Effect of enable-call-by-reference

荒凉一梦 提交于 2019-12-20 09:38:57

问题


I get the messages

<Warning> <EJB> <BEA-010202> <Call-by-reference is not enabled for the EJB 'myEjb'.
The server will have better performance if it is enabled. To enable call-by-reference, set the enable-call-by-reference element to True in the weblogic-ejb-jar.xml deployment descriptor or corresponding annotation for this EJB.>

and

<Warning> <EJB> <BEA-012035> <The Remote interface method: 'public abstract java.util.Collection my.sessionfassade.ejb.myFassade.myMethod(java.lang.String,java.lang.String,java.util.Collection) throws my.Exception' in EJB 'myEjb' contains a parameter of type: 'java.util.Collection' which is not Serializable. Though the EJB 'myEjb' has call-by-reference set to false, this parameter is not Serializable and hence will be passed by reference. A parameter can be passed using call-by-value only if the parameter type is Serializable.>

Why would this not be enabled by default, as remote calls are still possible and done by value if the flag is set to True? Is there any negative effect when setting it to True?


回答1:


call-by-reference = true is not compliant with the EJB specification.

The goal of remote EJBs was to provide a location transparency. In other words, if the target EJB is in another JVM, then clearly the data must somehow be copied to that JVM, so for consistency, calls to an EJB in the same JVM are also copied. If calls to an EJB in the same JVM weren't copied, then the caller/callee wouldn't know whether they need to defensively copy an ArrayList, for example. By always copying, this ambiguity is removed but at the cost of performance.

If you can fully trust all clients and EJBs in the same JVM and you establish a convention for copying data when necessary, then you can enable call-by-reference = true.



来源:https://stackoverflow.com/questions/6251797/effect-of-enable-call-by-reference

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!