grouplens/grapht — pull request #77 by elehack (2013-11-19 23:25:54+00:00)
Title: Clean up double-checked locking

Based on Effective Java 77, this cleans up double-checked (and single-checked) locking instances to first retrieve the volatile member into a locale cache variable. The point of this pattern is to speed up the fast case: if the cached value is present, there is only a single memory-fenced volatile fetch (to read the variable). Without it, reading the field twice, there are (at least) two memory fences.