• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Peter Rooke
  • Himai Minh
Bartenders:
  • Piet Souris
  • Mikalai Zaikin

Local Vs Remote

 
Ranch Hand
Posts: 393
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1. In case of remote interface, objects are passed by value or a copy is made
2. In case of local interface, objects are passeed by reference.

What if we use remote interface on the same VM. Would the object still passed by value.

Secondly in Zaikin notes I read the following lines

Non-remote objects must be passed by value.
The EJB container is not allowed to pass non-remote objects by reference on inter-EJB invocations when the calling and called enterprise beans are collocated in the same JVM.

Should'nt the opposite be true in this case. Non-remote objects or local objects must be passed on reference??
 
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,
I think a ejb called with a remote interface will always follow the remote semantics (with marshalling , unmarshallling etc..) I am saying this because I was just testing propagation of Container manager PersistenceContext with extended scope ,basically to test Persistence context inheritance. I was calling a stateful session bean from another, I passed the reference of a new entity(detached) from Bean A to Bean B ,and in Bean B method, I do a persist of the new entity.
and I noticed that after the Bean B method call returns ,the state of entity in Bean A i.e whether it is managed or detached was dependent on the type of interface I used to call Bean B from bean A. When I use Local then the entity remains managed in BeanA but if I use remote it is detached .This is because using a remote will serialize the entity and results in entity being detached .
 
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Anu Tilwalli:

What if we use remote interface on the same VM. Would the object still passed by value.



I am not 100% percent sure of this. But I would give my opinion. I feel when the @Remote is demarcated on a class, on compilation, it would but obviously create proxies and stubs. So any call made by using these stubs would naturally result in remote calls.

If the class is marked as @Local then it won't create the stubs for remote invocation.
[ May 14, 2008: Message edited by: nitin pai ]
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic