[concurrency-interest] CopyOnWrite wrappers Part 2 - now renamed

Martin Buchholz martinrb at google.com
Sat Dec 18 02:18:44 EST 2010

On Fri, Dec 17, 2010 at 12:43, Morgan Conrad <morganconrad at yahoo.com> wrote:

> I modified the JSR 166 Unit Tests to test my code, and have a couple of suggestions for improvements in them.
> 1) The code is currently highly specific to the class to be tested.  For example, ConcurrentHashMapTest always refers to a ConcurrentHashMap, when, most of the time, it could refer to a Map or ConcurrentMap.  For example, in testClear(), the first line could be changed
> public void testClear() {
>   Map map = map5();  // WAS ConcurrentHashMap
>   map.clear();
>   assertEquals(map.size(), 0);
> }
> This would make it easier to extend these tests to other implementations (like mine!).

I agree there are a number of improvements - refactorings and changes
such as yours that would make maintenance of the src/test/tck tests
easier.  You can see a start with BlockingQueueTest.java.  But it
would be a big project, and junit 3 is not providing any help.

> 2) I didn't see where the tests did much actual testing of concurrency.  Did I miss something - is this done elsewhere?  I realize that writing such test code is difficult.  My CISWrapperTest makes modest efforts.

There are different types of tests, with different provenance, in
Real concurrency tests often involve long-running loops that attempt
to elicit race conditions, and some of those can be found in
src/test/jtreg and src/test/loops.

 $ find -name '*.java' | xargs grep -l ConcurrentHashMap

More information about the Concurrency-interest mailing list