1 Reply Latest reply on Jun 28, 2017 8:56 AM by jaikiran

    Serialization of objects in local invocation

    arkadyz

      I am using Wildfly 8.2.0

       

      Have following code:

       

      @Stateless

      public class BeanA{

           @EJB

           BeanB beanB;

       

      ...

          beanB.someFunction(objA);

      }

       

      I thought objA should pass over serialization + de-serialization before it comes to implementation of "someFunction" of beanB, but I see the exact pointer to objA is coming to beanB.

      Can anyone one explain me what is the point here ?

       

      Thank you in advance.

        • 1. Re: Serialization of objects in local invocation
          jaikiran

          For in-vm (i.e. calls within the same JVM), the server makes an optimization and skips the serialization/deserialization of those objects that get passed around. It's not something to rely on but just an application server detail. However, this can be configured to be spec compliant and get the pass-by-value (essentially the serialize/deserialize) in the EJB3 subsystem by configuring the "pass-by-value" attribute of "in-vm-remote-interface-invocation" element. The details of it are available in the XSD of EJB3 subsystem (for example wildfly/wildfly-ejb3_5_0.xsd at master · wildfly/wildfly · GitHub )