EJB3 Remote Call

Are remote EJB calls made from the same application server always optimized as local calls in memory and are serialization of the data missed in this scenario?

In other words, is it correct to work with remote EJBs all the time, thus achieving decoupling between application components, even if two + EJB modules are deployed in the same container? I am using Glassfish.

Also, if I need to perform a search while working with remote EJBs (I don’t know the JNDI name of the EJB until runtime), which is the best way to cache calls using as little as possible the overhead for the existing EJB infrastructure provided by the application server (so that no additional libraries like Guice are just what Glassfish already offers).

+3
source share
1 answer

The semantics of the arguments to the remote services are different from the semantics for the local services. Because of their serialization behavior, remote services effectively have pass-by-value semantics (i.e., arguments are copied), while local services are standard java pass-by-reference. This is not just an assessment of performance, but also a change in the value of a parameter.

Because of this, I don’t think the container can optimize the call to the remote EJB interface as if it were local because of this semantic difference.

+3
source

Source: https://habr.com/ru/post/1727134/


All Articles