Home arrow static arrow Java Programming [Archive] - How to use Singleton under clustered enviroment
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - How to use Singleton under clustered enviroment
This topic has 4 replies on 1 page.

Posts:33
Registered: 3/30/01
How to use Singleton under clustered enviroment  
Aug 8, 2004 12:50 AM



 
Singleton pattern works well under single server.
Then how to use it under multi-server conditions.
Thanks
 

Posts:18,384
Registered: 21.03.00
Re: How to use Singleton under clustered enviroment  
Aug 8, 2004 1:15 AM (reply 1 of 4)



 
Hi,

It's always best to try to find the answer using google, or search in the forum. Google search on:
distributed singleton gives
http://www.smotricz.com/kabutz/Issue052.html

/Kaj
 

Posts:33
Registered: 3/30/01
Re: How to use Singleton under clustered enviroment  
Aug 8, 2004 10:03 PM (reply 2 of 4)



 
Thanks for resource you provided.
I saw use Message topic can update data among servers. But its not real time, Is there anyway I can sure that the value I used is update to date?
 

Posts:196
Registered: 6/24/97
Re: How to use Singleton under clustered enviroment  
Aug 9, 2004 4:18 AM (reply 3 of 4)



 
Many ways:

1) Write it out to a common file
2) Push it onto the global/distributed LDAP tree

Or better still:
3) Use a database table to hold state
 

Posts:21,718
Registered: 98-02-20
Re: How to use Singleton under clustered enviroment  
Aug 9, 2004 4:58 AM (reply 4 of 4)



 
Or, better yet, think that a Singleton might not be the best solution and try again. Sounds like a multi-server bottleneck in the making.

The EJB model doesn't support Singletons. There might be a good reason.

JMO. You know your problem, of course. I only mean this as a spur to think about an alternative point of view. Think carefully about whether you really must have a Singleton.

%
 
This topic has 4 replies on 1 page.