[concurrency-interest] Reordering and Immutability
oleksandr.otenko at oracle.com
Wed Feb 6 12:46:59 EST 2013
On 03/02/2013 21:21, David Holmes wrote:
> Yann Le Tallec writes:
>> (2) Same question with resource declared as "private static Resource
>> resource;" (without the "= null") and with the additional assumption
>> that Resource is immutable
>> - I am told that "Resource resource; can't race whereas Resource
>> resource = null; can", but I don't see why they are different from a
>> JMM perspective.
> There is no difference. "Resource resource;" implicitly sets resource to
> null during static initialization of the class.
Then it may also return a non-null value that is not even a valid
reference, and certainly doesn't necessarily reference a valid Resource
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Concurrency-interest