Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Avoiding RMI overheads between inter EJB communication with in same JVM

 
Naren Bhartiya
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to avoid RMI calls between two or more EJB(s) (Entity beans + session beans)?
Here are two approaches I heard about-
1) I guess the use of the Local Remote interface prevents RMI calls and marshaling or data. But this concept of putting local interface some how restricts to develop a generic EJB cause we never know which client will use it in which way. Does it mean we need to implement all 3 interfaces i.e. Remote, home and Local to write a generic bean?
2) The second way I heard but never used is deploying more than one EJB(s) using same deployment descriptor and bundling in one enterprise archive i.e.EAR file.
Which way is more effective? Any good comment will help us all.
Thanks!!
Java � make things beautiful.
 
vikasids sharma
Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See you cannot avoid RMI calls when your client code(eg.session bean) and Server code(eg Entity bean)lies in two different physical boundaries.This is paradigm of RMI and you have to use it like this only.
Originally posted by naren JavaGini:
How to avoid RMI calls between two or more EJB(s) (Entity beans + session beans)?
So far EJB specification does not provide any flag to distinguish between local Home interface and Home interface(As per my knowledge).It means you need to modify(interfaces) your code everytime when you want to shift client code and server code on same machine or the other way when shifting client code on different machine. Local interfaces are introduecd to avoid RMI calls between codes lying on same machine and ofcourse itz the efficient way of making calls rather than using stubs, skeletons. I would opt for using 2 interfaces rather than 3 depending upon the layed architecture.

Here are two approaches I heard about-
1) I guess the use of the Local Remote interface prevents RMI calls and marshaling or data. But this concept of putting local interface some how restricts to develop a generic EJB cause we never know which client will use it in which way. Does it mean we need to implement all 3 interfaces i.e. Remote, home and Local to write a generic bean?

I would suggest for using same deployment descriptor

2) The second way I heard but never used is deploying more than one EJB(s) using same deployment descriptor and bundling in one enterprise archive i.e.EAR file.
Which way is more effective? Any good comment will help us all.
Thanks!!
Java � make things beautiful.
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think how to use Local or Remote component are depend on purpose of bean.
please see topic 5.2 , 5.3, 5.4 in EJB Spec 2.0
will help..
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
2) The second way I heard but never used is deploying more than one EJB(s) using same deployment descriptor and bundling in one enterprise archive i.e.EAR file.


Some servers like weblogic,oracle 9ias, websphere support pass by refernce when remore interfaces are used. This is not a standard.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic