Re: JavaMemoryModel: Deliberate undersynchronization

From: Bill Pugh (pugh@cs.umd.edu)
Date: Mon Apr 26 2004 - 14:42:01 EDT


On Apr 24, 2004, at 3:22 PM, Doron Rajwan wrote:

>
> Except String.hash, is there any other "deliberate
> undersynchronization" in Tiger release?
>
> Doron.
>
>

Doug Lea has some in ConcurrentHashMap. Getting this right was very
tricky.

There are a bunch of places where the code performs lazy initialization
of
a primitive value (e.g., hashCode) or of a reference to an immutable
object.
These are generally safe.

FindBugs reports more than 264 cases of inconsistent synchronization.
Undoubtedly, some
of those are false positives, but I'm confident at least 100 of them
are real
synchronization errors. However, I'm not sure they are "deliberate
undersynchronization".

We also report 95 instances of incorrect double checked locking, and 44
cases of
unsynchronized getter methods that have synchronized set methods. Some
of these
probably overlap with the inconsistent synchronization warnings.

Bill

-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel



This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:01:06 EDT