Systems Engineering

Writingdev.to

Understanding the Singleton Pattern in Java

By Sachin Gupta6 min read
Portrait of Sachin Gupta rendered in binary

A walk through the Singleton pattern in Java, from lazy initialization to thread-safe and double-checked locking, the Bill Pugh approach, and enum-based singletons, including how each holds up against serialization and reflection.

Notes

A self-hosted write-up of this entry is on the way. In the meantime, the source link below has the canonical version, and the About page has context on the work I do day-to-day.

Related