4 Replies Latest reply on Dec 27, 2002 1:28 PM by adrian.brock

    Pass by reference to remote EJB - not spec compliant

      Hi,

      I checked the address of an object passed through a remote interface in Jboss 3.0.2 and found that, when the objects are in the same VM, I was getting pass by reference rather than the pass by value that the spec requires.

      I know this was an available optimization in JBoss 2.4, but I thought it had been removed with the introduction of local interfaces in JBoss 3.0.0.

      Am I missing something? Is there a way to get the spec-compliant behavior?

      Thanks,
      Nick

        • 1. Re: Pass by reference to remote EJB - not spec compliant

          Fixed for 3.0.5, use the ByValueInvokerInterceptor
          in the client configuration.

          But do you really want to pass by value?
          Serialization is slow, about 10 times slower
          as by Reference.

          By the way, I have made to no attempt to optimize the
          marshalling to get near to the x10.
          It is actaully about x25 in the current
          implementation. It just isn't worth constructing
          an "optimized" path from client to container
          just to get "not as slow".

          This is purely an exercise in spec compliance,
          I do not recommend you use it.

          Regards,
          Adrian

          • 2. Re: Pass by reference to remote EJB - not spec compliant

            I'm glad it's fixed - thanks.

            I appreciate your warnings about performance. My position is that if I don't want to pay for serialization I should use LOCAL interfaces. If I use REMOTE interfaces then I expect to pay the price.

            Unfortunately, some code RELIES on pass-by-value to work correctly. (That's how I found this problem!) While I would say that's poor coding style, it does open JBoss to the criticism that "it breaks some valid applications because it is not compliant".

            For that reason, I would actually prefer pass-by-value to be the DEFAULT for remote interfaces in 3.0.5. (You implied it has to be selected). But given that this is a great server for free, I'm certainly not going to complain over such trifles!

            Thanks again,
            Nick

            • 3. Re: Pass by reference to remote EJB - not spec compliant

              I've thought about this a bit more, and read a bit more, and decided my previous post was stupid (which is probably why it was politely ignored). Having pass-by-reference as the in-VM default is probably best - so long as users are aware of this.

              • 4. Re: Pass by reference to remote EJB - not spec compliant

                Correct.

                Serialization is bad!

                Regards,
                Adrian