3 Replies Latest reply on Oct 22, 2002 11:48 AM by sgturner

    Local vs Remote

    buster

      I am using Session and Entity EJBs that reside on the same server. Currently I am using InitialContext to lookup the Home interface and create instances. Is there something faster and less network intensive. I keep seeing "Local Home Interface" and "Local Interface" but I am not sure how to use them. The example I saw extended EJBLocalObject instead of EJBOject, is this correct. This example came from "Mastering EJBs" on theserverside.com
      Thanks
      Steve

        • 1. Re: Local vs Remote
          sgturner

          If the code that is doing the lookup of the home interface is in a different JVM as where the bean resides, you have to use remote. If the code is in the same JVM as the bean and you are using JBoss, you can use either remote or local - no difference. In the latter case, JBoss remote calls do the right thing - that is, not serialize and marshal data.

          • 2. Re: Local vs Remote
            drrus

            I'm not quite happy with your "no difference" answer. If a client uses a remote interface, it surely will expect parameters to be copied using serialization. So if the paramter is mutable and the EJB will make a change, there should be a difference between local and remote interfaces. I checked this on a simple example, JBoss definitely works different than Sun RI. I think it's quite smart to use local calls if possible, but JBoss has to copy parameters as Java RMI would do.

            • 3. Re: Local vs Remote
              sgturner

              You are right. Engineers have to understand what they are doing. In same JVM, it makes no difference if you call local or remote, the parameters are all passed by reference.