File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

SingleTon class

h kumar

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: 15087

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

Joined: Jul 08, 2003
Posts: 24199

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


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]
I agree. Here's the link:
subject: SingleTon class
It's not a secret anymore!