In Singleton Design Pattern, synchronization is essential ?

 Posted by Akiii on 1/10/2012 | Category: Design Pattern & Practices Interview questions | Views: 3042 | Points: 40

In Singleton Design Pattern , synchronization is essential only for the first time when the instance is to be created. When the instance is created then it becomes an overhead for each request.

public class Singleton

private static Singleton uniqueinstance;

private Singleton()

public static Singleton getinstance()
if(uniqueinstance == null)
uniqueinstance = new Singleton();
return uniqueinstance;

In the above code, when for the first time getinstance method is called, synchronization is needed. After the first instance is created, we no longer need synchronization.

Thanks and Regards

Asked In: Some Interviews | Alert Moderator 

Comments or Responses

Posted by: SheoNarayan on: 1/11/2012 | Points: 10
Very good effort, keep this series on !

Posted by: Akiii on: 1/12/2012 | Points: 10
Thank you very much Sheo Sir. I hope i can do better.

Posted by: babubabu43210-22824 on: 6/29/2013 | Points: 10
This youtube link has lot of J2EE/Design pattern Related viedos and playlist has been created for easy learning and learn .. Subscribe this channal to get update about the upcoming viedos..

Login to post response