Ensure a class only has one instance, and provide a global point of access to it.

-Design Patterns, GoF



1) When would you want to use the Singleton?

2) Should a Singleton ever have multiple instances?

3) What is lazy instantiation and why would you use it?

4) What protection should the constructor method have, and why?

5) When would you want to subclass the Singleton?

6) If there are multiple classloaders, what impact would that have on the Singleton pattern?

7) How can you make the Singleton thread safe?

8) Why would you use a Singleton registry?

9) How do you implement a Singleton that needs to be Serialized?


Examples Which are Composites?

1) Window Managers

2) Print spoolers


Implement It!

Create a generic Singleton that is thread-safe and serializable.