Local objects and RMI pass-by-reference

Discussions

EJB design: Local objects and RMI pass-by-reference

  1. Local objects and RMI pass-by-reference (3 messages)

    Hi,

    I have noticed that some EJB containers (at least JBoss and JOnAS) optimize local RMI calls by passing objects by reference instead of the default pass-by-value behavior. My question is, is this because prior versions to EJB 2 specification did not address the in-memory invokation issue. Is this the solution to taken by these vendors. The people behind the specification however came up with another solution, to use local objects.

    Regards
  2. Local objects and RMI pass-by-reference[ Go to top ]

    Hi!

    First of all, the EJB container is not allowed to pass a reference when calling a (non-local) EJB from another EJB in the same container. However, the container is allowed to use a faster protocol than RMI to do the call. But such a protocol must have the same effect as the standard Java RMI. As an example, I have heard that OC4J has an internal protocol 50 to 100 times faster than Java RMI.

    See sections 5.2 and D.6 (appendix) of the EJB 2.0 spec. for details.

    /Tomas
  3. Tomas is right as far as the spec goes, but in practice some application servers did optimize EJB calls using pass-by-reference, as a configurable optimization. The reason is exactly what you suggested: prior to EJB 2.0, all calls were remote, and this caused a substantial overhead. This is probably the biggest reason for the addition of local interfaces to the spec: when a non-standard feature that breaks the spec becomes a "pseudo-standard", something in the spec has to be fixed.

    Gal
  4. I agree with Gal, All Weblogic versions even prior to release of EJB2.0 use to have pass-by-value enables.Thus,optimising the calls within the local JVM.
    Also,you can configure your App Servers to use pass by value or pass by reference.
    -Jyot
    Data Concepts,LLC