Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

question about clustered servers

 
Raj Ohadi
Ranch Hand
Posts: 316
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic