JDK-6347106 : (coll) Make ArrayList(Collection) more threadsafe
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:collections
  • Affected Version: 1.4.1,5.0,6
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic,linux,windows_xp
  • CPU: generic,x86
  • Submitted: 2005-11-08
  • Updated: 2017-05-16
  • Resolved: 2006-03-23
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6 b78Fixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Description
This covers changes to Vector, ArrayList, and PriorityQueue
collection constructors that both make them accommodate
traversals with different numbers of elements than reported
size(), and as a byproduct makes them fail less often with
concurrently modified non-concurrent ones.

It is common for academic papers investigating concurrency bugs in the JDK
to cite the classic

Collection c = new Vector();
// Mutate c in another thread
Vector v = new Vector(c); // may fail unexpectedly

Here the concurrency issue is not with "this", but with the
argument collection, which has unknown concurrency properties,

Because of this, synchronized Vector and unsynchronized ArrayList have the same issues.

Comments
EVALUATION For logistical reasons, the changes for this CR will cover a new implementation for ArrayList(Collection), and changes in spec to PriorityQueue(Collection) and PriorityBlockingQueue(Collection). A future change (pending changes from Doug Lea) will cover PriorityQueue and PriorityBlockingQueue implementation.
04-03-2006

EVALUATION Yes. For logistical reasons, the fix for this is being split up into separate CRs. First to be fixed is CopyOnWriteArrayList and Vector(vector). (see... See Also) Eventually, the regression test HotPotatoes should be expanded to cover all interesting pairs of implementation class and method. At the very least, left to be done are ArrayList and PriorityQueue constructors.
08-11-2005