aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes question about clustered servers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "question about clustered servers" Watch "question about clustered servers" New topic
Author

question about clustered servers

Raj Ohadi
Ranch Hand

Joined: Jun 30, 2006
Posts: 316
When a j2ee .ear is deployed to clustered servers,

1) does each node in the cluster get one copy of .ear ?
2) if the .ear has a singleton pattern class, does each node get one class loaded separately ? or do they share one class in JVM ? I guess they can't share as each node in the cluster must have a separate JVM, right ?
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
I am new to EJB , but here is what I think about this.

regarding 1> Each of the nodes in the cluster would have a .ear deployed.

regarding 2> I think Singleton can be used , but all the jvm instances/nodes would have one object of the singleton.But it would be better to bind the object to JNDI.I do not know whether its possible or not.


Rahul Bhattacharjee
LinkedIn - Blog
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10288
    
168

Singletons dont work in a cluster. For that matter, even within a single JVM you can end up with multiple instances of a singleton (which is a totally different topic). There have been several discussions on how to workaround the "singleton in a cluster" issue. Some of the application servers have proprietary solution to this. At present, i am not able to find a similar discussion on this specific question. Will post it once i get it.


[My Blog] [JavaRanch Journal]
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10288
    
168

Originally posted by Jaikiran Pai:
At present, i am not able to find a similar discussion on this specific question. Will post it once i get it.


This is the one.
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
Originally posted by Jaikiran Pai:
Singletons dont work in a cluster. For that matter, even within a single JVM you can end up with multiple instances of a singleton (which is a totally different topic). There have been several discussions on how to workaround the "singleton in a cluster" issue. Some of the application servers have proprietary solution to this. At present, i am not able to find a similar discussion on this specific question. Will post it once i get it.


I understand that classloader hierarchy may lead to multiple object of the singleton per jvm.But binding it to a JNDI may be a good idea.Basically singleton has stuffs that can be shared by all the requests , so instead of creating multiple instances we have only one instance to serve all the clients.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: question about clustered servers