• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Clustering environment in WAS

 
rajesh godbole
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone clarify on following doubts:
How singleton objects are managed in clustered environment?
What does thread safe code implies in clustered environment?

Rajesh Godbole
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34396
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rajesh,
The "singleton" is one per JVM (one per cluster.)

Similarly for thread safe, you get one set of static variables per cluster. You have to make sure the singleton/thread resources aren't controlling access to anything external. Otherwise you could have two accessing, say the database, at the same time.
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jeanne Boyarsky:
Rajesh,
The "singleton" is one per JVM (one per cluster.)


I'm not quite sure what you're getting at there, Jeanne. If you take a standard application (not built for clustering) that uses the singleton pattern and then deploy it in a clustered environment, then you will get one singleton per JVM, which means many per cluster. That's generally a recipe for disaster...

Could you clarify what you mean?

Kyle
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34396
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Kyle Brown:
I'm not quite sure what you're getting at there, Jeanne. If you take a standard application (not built for clustering) that uses the singleton pattern and then deploy it in a clustered environment, then you will get one singleton per JVM, which means many per cluster.

I actually meant to say one per clone, not one per cluster. Doh! So if there are two horizontal clones and two vertical clones, there are four copies of the "singleton." Right?

That's generally a recipe for disaster...

I agree!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic