Improved bulk operation disclaimers for concurrent collections

Doug Lea dl at cs.oswego.edu
Fri Apr 22 11:53:16 UTC 2011


Here's another set of very minor javadoc updates: The lists of
non-atomic "bulk" operations were incomplete in some concurrent
collections and missing in others, as was noted in a recent ASPLOS paper
"Specifying and Checking Semantic Atomicity for Multithreaded Programs"
by Jacob Burnim, George Necula, Koushik Sen. (See
http://www.cs.berkeley.edu/~jburnim/pubs/BurnimNeculaSen-ASPLOS11.pdf).
A sample update is below. I updated jsr166 versions. I'll work
with the usual folks to create a CR and integrate. (Thanks very
much to Chris Hegarty in particular for being so helpful with these
integrations!)


diff -r1.73 ConcurrentLinkedQueue.java
46c46,53
<  * of elements requires a traversal of the elements.
---
 >  * of elements requires a traversal of the elements, and so may report
 >  * inaccurate results if this collection is modified during traversal.
 >  * Additionally, the bulk operations <tt>addAll</tt>,
 >  * <tt>removeAll</tt>, <tt>retainAll</tt>, <tt>containsAll</tt>,
 >  * <tt>equals</tt>, and <tt>toArray</tt> are <em>not</em> guaranteed
 >  * to be performed atomically. For example, an iterator operating
 >  * concurrently with an <tt>addAll</tt> operation might view only some
 >  * of the added elements.



More information about the core-libs-dev mailing list