On Thu, 22 Sep 2011 11:03:02 +0200, Nourredine
<[email protected]> wrote:
Thanks to Martin, I realized that my sample was not relevant and that the
conditioned lock around the holder, in PerthreadManagerImpl, is not a
problem and maybe, "in the worst case", only redundant.
Indeed, PerThreadServiceCreator somewhat looks like a race bug and might
deserve a comment explaining why it's not:
if (perThreadValue.exists())
return perThreadValue.get();
return perThreadValue.set(delegate.createObject());
Eventhough it's not obvious at a first glance, I believe this really is
thread safe since the ThreadLocal in PerthreadManagerImpl#holder holds the
only mutable object involved here.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]