3 ms·
The safety guarantees only apply to final fields, it's entirely possible to see non-final fields in a half initialized state, and even half written longs becaus
by aardvark179 9y ago
The safety guarantees only apply to final fields, it's entirely possible to see non-final fields in a half initialized state, and even half written longs because the memory model does not guarantee those operations are atomic. To be safe in those cases you must use synchronization or something else that establishes a happens before relationship.
I think there's some good talks on the JMM on YouTube, and stuff on Shipilev"s blog.