: Artur Biesiadowski <[EMAIL PROTECTED]> writes:
: 
: > Are you sure that BitSet should be internally synchronized ?
: 

Paul Fisher <[EMAIL PROTECTED]> wrote:

: Unless the JLS specifies otherwise, Java data structures are generally
: assumed to be thread-safe.
: 
: In this case, the example code given for BitSet.hashCode in the JLS is
: synchronized, which would seem to imply that BitSets should be
: thread-safe.

I have written a small test program and the result is

1) For JDK-1.1.7 all Methods in BitSet except size() are synchronized.
2) For JDK-1.2   no Method is synchronized.

If no one argues, I will remove the synchronization.

  Jochen

P.S: The test program uses two threads, one that allocates the
monitor, while the other calls the method.  If the method call doesn't
succeed within a given time, it is assumed that the method is
synchronized.  The test program (a quick hack) can be found at:

http://www.Informatik.Uni-Oldenburg.DE/~delwi/classpath/SynchronizedTest.java

Reply via email to