Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

LookUp the same EJB deployed in 2 different boxes in cluster  RSS feed

 
Sam Gehouse
Ranch Hand
Posts: 281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any discussion on best practices for looking up EJB in multiple servers that are clustered?

E.g. EJB1.ear is deployed in 2 different WebSphere boxes - box1 and box2. My code (e.g. code.ear) is also deployed in box1 and box2.

Within box 1, code.ear is deployed in a server called Svr1 and EJB1.ear is deployed in a server called Svr2.

Same goes for box2.

I am using WebSphere 5.1.x

Hashtable properties = new Hashtable();
properties.put(Context.PROVIDER_URL, url);
// url = "iiop://" + "myhostname" + ":" + "MyPortNumber";

Can I do the following things?
1) Can I specify virtual host as the hostname for both box1 and box2?

2) Can I skip providing port number?

By doing the above 2 things, can I still get reference to the same EJB that is deployed in box1 and box2?
 
Valentin Tanase
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sam,

Usually after looking up a bean, what you'll get back is a clustered RMI stub. This stub maintains a list of all servers in the cluster and it also implements the load balancing algorithm. Hence although you looked up the bean on machine1, the requests will be sent to other servers in the cluster as well. However the container could implement very sophisticated algorithms in order to improve the performances. An example could be the collocated ejb objects. If you have a session fa�ade that accesses entity ejbs, what will happen is that the container will make sure that the client requests never lives the same server. Hence all request coming from SLSB A will be redirected to entity ejbs located on the same server instance. Only if the server fails, then the request will be redirected to another server in the cluster.
Regards.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!