• Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB 3.0 and java.rmi.Remote

 
Sorin Alexandru
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Dear all,

I understand EJB 3.0 supports RMI-IIOP and this protocols allows the pass-by-reference style, so in principle we could have an EJB method, say
,
where MyType implements java.rmi.Remote (NOT Serializable, in which case it would be pass-by-value semantics).

Does this really work ? Do you have a good use case for the pass-by-reference scenario in EJB ?

Thank you,
Best regards,
Sorin
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35716
412
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorin Alexandru wrote: Do you have a good use case for the pass-by-reference scenario in EJB ?

A few application servers have allowed pass-by-reference for local beans in 2.X as well. I recommend not using this "feature." Even if the bean is passed by reference, changing it yields two problems:
  • if you ever want to add a remote interface, you have a problem/rewrite ahead of you
  • the caller isn't aware the bean changed (as it isn't common) which introduces subtle defects
  •  
    Sorin Alexandru
    Greenhorn
    Posts: 28
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Jeanne Boyarsky wrote:
    Sorin Alexandru wrote: Do you have a good use case for the pass-by-reference scenario in EJB ?

    A few application servers have allowed pass-by-reference for local beans in 2.X as well. I recommend not using this "feature." Even if the bean is passed by reference, changing it yields two problems:
  • if you ever want to add a remote interface, you have a problem/rewrite ahead of you
  • the caller isn't aware the bean changed (as it isn't common) which introduces subtle defects


  • Hi Jeanne,

    I wasn't referring to the bean being passed by reference.
    I meant the bean could have a business method which gets a parameter passed by reference. In that case, a call on that parameter would mean a callback to the client side, which is a potentially interesting feature. The only issue I see is if the client is behind a firewall, then the callback can't be done.

    Greetings,
    Sorin
     
    Jeanne Boyarsky
    author & internet detective
    Marshal
    Posts: 35716
    412
    Eclipse IDE Java VI Editor
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    That's still pass by reference. Everything I said applies. Except it's worse because it mucks up the layers in the architecture!
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!