aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Remote or local call Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Remote or local call" Watch "Remote or local call" New topic
Author

Remote or local call

Hari babu
Ranch Hand

Joined: Jun 25, 2001
Posts: 208
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

Joined: Nov 28, 2001
Posts: 136
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

Joined: May 05, 2000
Posts: 13974
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.


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Jim Bertorelli
Ranch Hand

Joined: Nov 28, 2001
Posts: 136
Yeah...I agree with that.
JeanLouis Marechaux
Ranch Hand

Joined: Nov 12, 2001
Posts: 906
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


/ JeanLouis<br /><i>"software development has been, is, and will remain fundamentally hard" (Grady Booch)</i><br /> <br />Take a look at <a href="http://www.epfwiki.net/wikis/openup/" target="_blank" rel="nofollow">Agile OpenUP</a> in the Eclipse community
ruilin yang
Ranch Hand

Joined: Feb 25, 2001
Posts: 334
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

Joined: May 05, 2000
Posts: 13974
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Remote or local call