本文介绍了启用调用引用的效果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到消息

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

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?

推荐答案

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

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

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

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.

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

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.

这篇关于启用调用引用的效果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 20:32