2 ms·
if the field is volatile, you have an happen before relationship between the volatile read of thing before the synchronized block and the volatile write inside
by _old_dude_ 10y ago
if the field is volatile, you have an happen before relationship between the volatile read of thing before the synchronized block and the volatile write inside the synchronized block, so you have no way to see the object partially initialized.
It only works with the updated semantics of volatile (Java 5+), otherwise you're right.