Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remote EJB3 invocation

Tags:

java

ejb-3.0

Are remote EJB calls, made from the same application server, always optimized as local, in-memory calls, and is serialization of data skipped in this scenario?

In other words, is it valid 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'm using Glassfish.

Also, if I have to do runtime lookup of the remote EJBs (I don't know the JNDI name of EJB until runtime), what is the best way to cache the calls, using as little as possible overhead on the existing EJB infrastructure provided by the app server (so, no additional libraries like Guice, just what Glassfish already offers).

like image 844
bozo Avatar asked Apr 09 '26 15:04

bozo


1 Answers

The argument semantics of remote services are different to that for local services. Remote services, because of their serialization behaviour, effectively have pass-by-value semantics (i.e. the arguments are copied), whereas local services are standard java pass-by-reference. This is more than just a performance consideration, it changes the meaning of what a parameter is.

Because of this, I don't think a container can optimize a call to a remote EJB interface as though it were a local one, due to this semantic difference.

like image 197
skaffman Avatar answered Apr 11 '26 05:04

skaffman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!