Skip to Content
Design Patterns Explained: A New Perspective on Object-Oriented Design, Second Edition
book

Design Patterns Explained: A New Perspective on Object-Oriented Design, Second Edition

by Alan Shalloway, James R. Trott
October 2004
Beginner
480 pages
8h 43m
English
Addison-Wesley Professional
Content preview from Design Patterns Explained: A New Perspective on Object-Oriented Design, Second Edition

Chapter 21. The Singleton Pattern and the Double-Checked Locking Pattern

Overview

This chapter continues the e-commerce case study introduced in Chapter 9, “The Strategy Pattern.”

This chapter

•   Illustrates how a factory can control the number of instances of an object that can ever exist, using the Singleton pattern.

•   Describes the key features of the Singleton pattern.

•   Introduces a variant to the Singleton called the Double-Checked Locking pattern.

•   Describes some of my experiences using the Singleton pattern in practice.

The Singleton pattern and the Double-Checked Locking pattern are very simple and very common. Both are used to ensure that only one object of a particular class is instantiated. The distinction ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Design Patterns Explained: A New Perspective on Object-Oriented Design

Design Patterns Explained: A New Perspective on Object-Oriented Design

Alan Shalloway, James R. Trott
Design It!

Design It!

Michael Keeling

Publisher Resources

ISBN: 0321247140Purchase book