aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Doubt abt local and remote interfaces Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Doubt abt local and remote interfaces" Watch "Doubt abt local and remote interfaces" New topic
Author

Doubt abt local and remote interfaces

Sue Pillai
Ranch Hand

Joined: Nov 04, 2004
Posts: 89
If I had both the client and the EJB in the same container, do I have to use only local client interfaces, or can I implement remote interfaces?

That is can I use remote even though client is presently local? The scenario is if the application were to expand and if there is a chance that in future the client might become remote, I shouldn't have to change the client code to catch remote exceptions & do narrowing, etc.. right?

Does writing remote interfaces for local clients reduce performance?


Sue

SCJP 1.2
SCWCD 1.4
SCBCD 5.0
Frederic Esnault
Ranch Hand

Joined: Feb 13, 2006
Posts: 284
Hi Sue !

I was thinking of what I would answer but your question already contains answer.

First of all, it is perfectly legal to define both local and remote interfaces for your beans. The only thing is you must NEVER mix them (ie do not make a remote home interface create method returning a local component interface, or anything like that).

But what you say is good, using local interface should be reserved to scenarios where you are 100% sure you will NEVER have clients and beans on different VM. This is quite hard to be so sure. For scalability needs it's still good to use remote interfaces even locally, so that the day you change, your app does NOT need any modification.

Of course, remote interface add overhead to your processings. It's up to you to decide wether your app architecture is worth the overhead.

Hope it helps.


SCJP 5 - SCWCD 1.4 - SCBCD 1.3 - Certification study documents/resources: http://esnault.frederic.free.fr/certification
Sue Pillai
Ranch Hand

Joined: Nov 04, 2004
Posts: 89
Thanks Frederic, I just wanted to be doubly sure that it can be done in real time.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt abt local and remote interfaces