Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

when a servlet calls EJB methods, is it a remote or a local call?

 
Sat Nar
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a basic doubt. If i am developing a servlet and EJB in Weblogic application server, and my servlet calls methods in EJB. Now, is this call a remote call?Is the servlet, a local or remote client?

Thanks in advance.

Regards,
Sathya
 
aleem khan
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is a local as both are in same weblogic server
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34410
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sathya,
It is a local client. You can make either a local or remote call from a local client. You are more likely to be making a local call, but you should check that you are using the local interface.
 
Sat Nar
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks lavani & Jeanne for your replies.

Jeanne,
You said that one can make either a local or remote call from a "local client".My doubt is whats the purpose of a remote call from a local client if it can be a local call?Is there not overhead in making a remote call?So use a remote call only if your client is a remote client.This is my understanding.Kindly correct me if iam wrong.

My understanding of a remote call is that if the client and the EJB are present in different Application servers, then it is a remote call. Is my undestanding correct?

In Head First EJB, the author says that if two object present in different heaps, then if one object calls the other, then it is a remote call.
My doubt is what do you mean by "two different heaps"? Is it two different servers or two different JVM's or what is it?

Kindly help me out.

Thanks in advance.
 
arulk pillai
Author
Ranch Hand
Posts: 3387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My understanding of a remote call is that if the client and the EJB are present in different Application servers, then it is a remote call. Is my undestanding correct?


Yes, you should say two different JVMs (i.e. processes).

In Head First EJB, the author says that if two object present in different heaps, then if one object calls the other, then it is a remote call.
My doubt is what do you mean by "two different heaps"? Is it two different servers or two different JVM's or what is it?


Each JVM (i.e. is a process) has its own heap space. If you make a call from one process (e.g. JVM) to another process, then it is a remote call because the memory address spaces (e.g. heap space) are different. Remote calls require serialization.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34410
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sat Nar:
Jeanne,
You said that one can make either a local or remote call from a "local client".My doubt is whats the purpose of a remote call from a local client if it can be a local call?Is there not overhead in making a remote call?So use a remote call only if your client is a remote client.This is my understanding.Kindly correct me if iam wrong.

You are correct. It's POSSIBLE to make a remote call from the same app. That doesn't make it a good idea. The reason it is possible is that EJB 1 didn't have local interfaces. For backward compatibility and to support old applications that make remote calls, this needs to continue to be supported.


My understanding of a remote call is that if the client and the EJB are present in different Application servers, then it is a remote call. Is my undestanding correct?

Also correct.
 
Ajay Saxena
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For application servers that have co-located web and ejb containers,I believe there's only ONE JVM that runs with different threads listening on HTTP and RMI/IIOP ports.Is that correct?
[ August 30, 2008: Message edited by: Ajay Saxena ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic