I want to make sure that I correctly understand the \'Effectively Immutable Objects\' behavior according to Java Memory Model.
Let\'s say we have a mutable class which
Yes. The write operations on the MutableLong
are followed by a happens-before
relationship (on the volatile) before the read.
(It is possible that a thread reads Outworld.published
and passes it on to another thread unsafely. In theory, that could see earlier state. In practice, I don't see it happening.)