Tag

LazyInitialization

0 views collected around this technical thread.

Top Architecture Tech Stack
Top Architecture Tech Stack
Oct 13, 2023 · Fundamentals

Java Singleton Pattern: Eager, Lazy, Double‑Check Locking, Holder, and Enum Implementations

This article explains several common Java singleton implementations—including lazy ("hungry"), eager, double‑checked locking, holder, and enum patterns—detailing their code, thread‑safety characteristics, performance trade‑offs, and pitfalls such as partial initialization and reflection attacks.

DesignPatternEnumJava
0 likes · 10 min read
Java Singleton Pattern: Eager, Lazy, Double‑Check Locking, Holder, and Enum Implementations