junit-team/junit — pull request #666 by Tibor17 (2013-04-11 23:19:44+00:00)
Title: Treatments for parallel execution

In parallel execution, the objects like runners, Description, TestClass are created in main Thread and used in forked Thread. This will treat the multithreaded visibility.

Added final field modifier in:
AnnotatedBuilder, Parameterized, TestClass

Added volatile field modifier in:
ClassRequest, JUnit38ClassRunner, Description, ParentRunner

Description: ArrayList replaced with ConcurrentLinkedQueue used out of the class
Descrioption#getChildren() returns backed ArrayList since it returns ArrayList and not List. It is not modified from outside.

Parameterized: ArrayList of runners replaced with CopyOnWriteArrayList

ParentRunner: ArrayList of fFilteredChildren replaced with ConcurrentLinkedQueue
The Collections.sort() uses ListIterator#set() which is unsupported in CopyOnWriteArrayList
Removals on fFilteredChildren are not concurrent.

Suite: backed fRunners with CopyOnWriteArrayList

TestClass: replaced only collections which are used out of the class
HashMap replaced with ConcurrentHashMap
ArrayList replaced with CopyOnWriteArrayList