File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes Session Facade and cluster 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 "Session Facade and cluster" Watch "Session Facade and cluster" New topic
Author

Session Facade and cluster

Steve Ford
Greenhorn

Joined: Apr 19, 2004
Posts: 20
I am fairly new to EJB's and I have a concern about implementing a Session Facade for my application. I understand that one of the primary benefits of a session facade is that the facade will access the entity beans via their local interfaces, and if the client (web) accessed the entity beans directly they would have to do so via remote interfaces which are slower because they use RMI etc. But what if the EJB's will be deployed in a clustered environment? I thought local interfaces could only be used if the beans were guaranteed to be running under the same JVM. Since my app will be running in a clustered WAS environment, does this mean that I can't use local interfaces? And therefore one major benefit of a session facade, is out the window? Any info is appreciated.
Valentin Tanase
Ranch Hand

Joined: Feb 17, 2005
Posts: 704
Hi Steve,

There are couple of conditions that need to be met for an application in order to use the local interfaces. First of course implies that the client and the server run in the same jvm (no remote clients). The second is probably less intuitive and implies that both the client and the server must be loaded by the same classloader. For example at least in theory, deploying the web app and the ejbs in the same ear will meet the last condition, while deploying them as separate war and jar(s) won�t.
To answer to your question, you definitely can use local interfaces, if you web components and your ejbs are packed together in the same ear. This will work in a cluster environment as well. The trick is that once an http request was send to one web app in the cluster, the server will always use special algorithms to improve the performances for collocated ejb objects. Subsequently all other calls for the same client/thread will be redirected to ejbs located on the same server (the request never lives the current server).


I think, therefore I exist -- Rene Descartes
Steve Ford
Greenhorn

Joined: Apr 19, 2004
Posts: 20
Thank you, makes perfect sense.
Valentin Tanase
Ranch Hand

Joined: Feb 17, 2005
Posts: 704
You're very welcome Steve
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Session Facade and cluster