How can you ensure thread-safe lazy initialization of a singleton without using synchronized in Java?

I’m trying to implement a thread-safe, lazily initialized singleton in Java, but I want to avoid using synchronized for performance reasons. I know about stuff like the Bill Pugh Singleton pattern and double-checked locking, but are there other clean approaches?

submitted by /u/SimonPowellGDM
[link] [comments]

from Software Development – methodologies, techniques, and tools. Covering Agile, RUP, Waterfall + more! https://ift.tt/LtQGIlX

Leave a comment

Design a site like this with WordPress.com
Get started
search previous next tag category expand menu location phone mail time cart zoom edit close