Hi Felix


> I am neither an export on any Memory Model issue, but I always thought
> that the construct
>
>     fieldX = new SomeType(zzz);
>
> would be ok, because fieldX would only be set after the SomeType
> instance has properly been setup and ready for use.


I would have thought the same if I had not learned it differently... again,
there is some black magic in the Java air ;)
I do not understand this mechanism in the memory model but I would be
thankful if someone could provide an explanation. The only thing I did is a
pattern matching between the lazy initialization in SimpleWebDavServlet and
the two books mentioned above. Both state that this implementation is not
thread safe.



>
>
> Have you encountered a concrete problem with this or is a pure academic
> discussion ?



This is pure academic, but I crunch multi-threading bugs rather on this
level than tracking bugs that just happen "now and then".

Marc

Reply via email to