permaculture playing cards*
The moose likes Websphere and the fly likes Clustering environment in WAS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "Clustering environment in WAS" Watch "Clustering environment in WAS" New topic
Author

Clustering environment in WAS

rajesh godbole
Ranch Hand

Joined: Jan 10, 2003
Posts: 31
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30130
    
150

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
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


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30130
    
150

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!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Clustering environment in WAS
 
Similar Threads
clustered environment - Singleton class
is it safe to put objects in HttpRequest(for a cluster environment)
singleton
Static Data
caching