Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Remote or local call

 
Hari babu
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
If one of my method in session bean calls another method in the same bean will it be a Remote or local call.If it is remote then any suggestion on how to avoid that?

Hari
 
Jim Bertorelli
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It depends on how you are calling the method.
1. If you are calling it directly like this:
public void m1()
{
...
m2(); //this is a local call
...
}
2. If you call it by though the remote interface reference, the call is "theoretically" remote but "practically" still local. Because most of the EJB containers will short circuit the call.
-Jim.
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should never make direct calls to EJB objects. This is very bad form.
If you are using EJB 2.0 you can set up local interfaces for EJBs.
 
Jim Bertorelli
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah...I agree with that.
 
JeanLouis Marechaux
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It depends on the EJB release U are using.
EJB 1.1 is based on RMI, so eah call is remote.
In EJB 2.0, there is a local interface for Session and entity bean you can use to avoid remote calls
 
ruilin yang
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe Hari is talking about method calls in the same EJB class. I believe it is a local call (as the way Jim indicated) and also it is a right way to call locally in the same EJB class since it is in the same class.
Originally posted by Hari babu:
Hi,
If one of my method in session bean calls another method in the same bean will it be a Remote or local call.If it is remote then any suggestion on how to avoid that?

Hari


[This message has been edited by ruilin yang (edited December 06, 2001).]
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Hari babu:
Hi,
If one of my method in session bean calls another method in the same bean will it be a Remote or local call.
In the same bean? That is always a local call.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic