GeeCON Prague 2014*
The moose likes Beginning Java and the fly likes SingleTon class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "SingleTon class " Watch "SingleTon class " New topic
Author

SingleTon class

h kumar
Greenhorn

Joined: Jul 03, 2007
Posts: 13
HI All,

Can any one give answer for this question...

how can you make singleton class as threadsafe ?
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14192
    
  20

Before you post a question, please take a moment to think in which forum you can post it best: carefully choose one forum.

This question does not have anything to do with Tomcat - I will move it to a more appropriate forum.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
bart zagers
Ranch Hand

Joined: Feb 05, 2003
Posts: 234
This is actually a Javaranch FAQ question (also read the linked newsletter entry).
Krithika Srinath
Ranch Hand

Joined: Apr 11, 2006
Posts: 52
take a look at this faq.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Originally posted by Krithika Srinath:
take a look at this faq.


Sigh.

No, don't take a look at that FAQ. It shows the (discredited) "double-checked locking" technique. It's wrong and not thread-safe.


[Jess in Action][AskingGoodQuestions]
 
GeeCON Prague 2014
 
subject: SingleTon class