首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >enable-call-by-reference的效果

enable-call-by-reference的效果
EN

Stack Overflow用户
提问于 2011-06-06 20:11:14
回答 1查看 11.4K关注 0票数 13

我收到消息了

代码语言:javascript
复制
<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.>

代码语言:javascript
复制
<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.>

为什么在默认情况下不启用此功能,因为如果该标志设置为True,远程调用仍然是可能的,并且是通过值完成的?设置为True会有什么负面影响吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-06-07 09:12:42

call-by-reference = true不符合EJB规范。

远程EJB的目标是提供位置透明性。换句话说,如果目标EJB在另一个JVM中,那么显然必须以某种方式将数据复制到该JVM中,因此为了保持一致性,对同一JVM中的EJB的调用也会被复制。例如,如果对同一个JVM中的EJB的调用没有被复制,那么调用者/被调用者就不知道他们是否需要防御性地复制ArrayList。通过总是复制,这种歧义被消除了,但以性能为代价。

如果您可以完全信任同一JVM中的所有客户端和EJB,并且建立了在必要时复制数据的约定,那么您可以启用call-by-reference = true。

票数 16
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6251797

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档