CentralAdvisor explains what is singleton pattern - good and bad by Bogdan Ionescu

CentralAdvisor explains what is singleton pattern - good and bad by Bogdan Ionescu

Already a Member? Log In to Your Account

CentralAdvisor explains what is singleton pattern - good and bad by Bogdan Ionescu

Posted on Jun 30 2012 at 03:00:06 PM in Programming

CentralAdvisor explains what is singleton pattern - good and bad by Bogdan Ionescu

This design pattern is used for controlling the number of instances of a class (to one in general). This is maybe the first, the most used and the easiest design pattern out there.

Beware that this control ( controlling the number of instances of a class ) is available per classloader, and not for JVM, not to say more when thinking at distributed topologies. This is because the final static instance variable – being static is per class basis. As you know now, in a JVM you can have more than one classloader – meaning you can load the same Singleton implementing class more than once (once per classloader). Loading more than once the Singleton implementing class results in the possibility of having n instances controlled by the singleton per JVM, where n represents the number of the loads of the Singleton implementing class, so will need at least n classloaders.

more on http://centraladvisor.com/design-patterns/what-is-singleton-pattern/

  Article Information
Created: Jun 30 2012 at 03:00:06 PM
Updated: Jun 30 2012 at 03:00:06 PM
Category: Programming
Language: English

  Share
Stumbleupon
Digg
Delicious
Reddit
© 2006-2014 OnToplist.com, All Rights Reserved