launcher icon indicating copy to clipboard operation
launcher copied to clipboard

Double-Checked Locking

Open QiAnXinCodeSafe opened this issue 5 years ago • 0 comments

https://github.com/fujitsu/launcher/blob/0339f0bf2f9cb5c82b761b6b873cd4830c7dc268/launcher-impl/glassfish/src/main/java/com/sun/web/security/RealmAdapter.java#L511-L522

Double-Checked Locking is widely cited and used as an efficient method for implementing lazy initialization in a multithreaded environment. Unfortunately, it will not work reliably in a platform independent way when implemented in Java, without additional synchronization. declares the cnonces field volatile offers a much more elegant solution

QiAnXinCodeSafe avatar Jan 19 '20 10:01 QiAnXinCodeSafe