Re: Happens before between putting and getting from and to ConcurrentHashMap

2018-11-17 Thread John Hening
Gil, thank you. In the docs it is written Retrievals reflect the results of the most recently *completed* update > operations holding upon their onset. (More formally, an update operation > for a given key bears a *happens-before* relation with any (non-null) > retrieval for that key

Re: Happens before between putting and getting from and to ConcurrentHashMap

2018-11-17 Thread yawkat
I don't think this is correct. First of all, it's not really relevant if String is immutable or not, in this case: It could already break at the (non-final, non-volatile) field x, which could be null if an instance of P was unsafely published. Of course, String being immutable has the

Re: Happens before between putting and getting from and to ConcurrentHashMap

2018-11-17 Thread John Hening
@Gil Tene, thanks for your response. But in other cases where non-final fields are involved, e.g. if p.x was a > Foo with a non-final field y with a getter, p.x.getY() may return an > uninitialized value after the get() returns a non-null p. > So, it means that in this case: class Foo {