Thanks for the explanations, Peter. Initialization loops are nasty. On 01/09/2013 05:04 PM, Peter Levart wrote: > On 01/09/2013 01:19 PM, Aleksey Shipilev wrote: >> c) What's the merit of using Unsafe instead of field updaters >> here? (Avoiding the dependency on j.u.c?) > [snip] So if there are any objections to usage of Unsafe, it can be > removed and replaced by simple volatile write.
Yes, I think that would be more clear without any adverse impacts on performance. Also, that better expresses the intent of requiring the visibility, not the atomicity of cache update. -Aleksey.