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

Morgan Conrad morganconrad at yahoo.com
Fri Dec 17 15:43:13 EST 2010


Thanks to all of you for the feedback, particularly Jed Wesley-Smith.  I've updated the code to reflect many of the comments and suggestions.  The major change is in the naming, to CISListWrapper and CISMapWrapper, to make it clear that they aren't "true" CopyOnWrite and avoid confusion and surprises.

http://flyingspaniel.blogspot.com/2010/12/copyonwrite-wrappers-part-2-now-cis.html

or

http://flyingspaniel.wikidot.com/cow


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!).

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.

Again, thanks to everybody for the feedback and hopefully somebody will find this useful.





      


More information about the Concurrency-interest mailing list