Netflix/genie

Double-Checked Locking

Closed this issue · 0 comments

if (jobInfo != null) {
synchronized (jobInfo) {
jobInfo = jobs.get(jobId);
if (jobInfo != null) {

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.