performance - enable-call-by-reference 的效果

标签 performance weblogic ejb

我收到消息

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


<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 时是否有任何负面影响?

最佳答案

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

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

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

关于performance - enable-call-by-reference 的效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6251797/

相关文章:

java - JDBC Pool 已挂起,无法为应用程序分配资源

java - 在 Java Web 应用程序中实现 WebLogic Workmanager

java - 由 SQL 连接查询映射的 JPA 实体

Windows CPU 调度程序 - 非常高的内核时间

performance - D 的快速线性系统求解器?

java - 限制对 WebLogic 中特定 EJB 的@Asynchronous 请求的数量?

java - 使用有状态 EJB 部署项目期间的 Glassfish 异常

java - 在EJB项目中使用Jboss动态加载DataSource

c - 附加到正在运行的进程的分析器?

ios - 从 UIView 截取屏幕截图 (UIImage) 需要太长时间