@@ -265,11 +265,11 @@ void invokeAll(List<? extends TestTask> testTasks) {
265265
266266 List <TestTask > isolatedTasks = new ArrayList <>(testTasks .size ());
267267 List <TestTask > sameThreadTasks = new ArrayList <>(testTasks .size ());
268- var forkedChildren = forkConcurrentChildren (testTasks , isolatedTasks ::add , sameThreadTasks );
268+ var reverseQueueEntries = forkConcurrentChildren (testTasks , isolatedTasks ::add , sameThreadTasks );
269269 executeAll (sameThreadTasks );
270- var queueEntriesByResult = tryToStealWorkWithoutBlocking (forkedChildren );
271- tryToStealWorkWithBlocking (queueEntriesByResult );
272- waitFor (queueEntriesByResult );
270+ var reverseQueueEntriesByResult = tryToStealWorkWithoutBlocking (reverseQueueEntries );
271+ tryToStealWorkWithBlocking (reverseQueueEntriesByResult );
272+ waitFor (reverseQueueEntriesByResult );
273273 executeAll (isolatedTasks );
274274 }
275275
@@ -299,33 +299,32 @@ else if (child.getExecutionMode() == SAME_THREAD) {
299299 }
300300 forkAll (queueEntries );
301301 }
302-
302+ queueEntries . sort ( reverseOrder ());
303303 return queueEntries ;
304304 }
305305
306306 private Map <WorkStealResult , List <WorkQueue .Entry >> tryToStealWorkWithoutBlocking (
307- List <WorkQueue .Entry > forkedChildren ) {
307+ List <WorkQueue .Entry > queueEntries ) {
308308
309309 Map <WorkStealResult , List <WorkQueue .Entry >> queueEntriesByResult = new HashMap <>(
310310 WorkStealResult .values ().length );
311- if (!forkedChildren .isEmpty ()) {
312- forkedChildren .sort (reverseOrder ());
313- tryToStealWork (forkedChildren , BlockingMode .NON_BLOCKING , queueEntriesByResult );
311+ if (!queueEntries .isEmpty ()) {
312+ tryToStealWork (queueEntries , BlockingMode .NON_BLOCKING , queueEntriesByResult );
314313 }
315314 return queueEntriesByResult ;
316315 }
317316
318317 private void tryToStealWorkWithBlocking (Map <WorkStealResult , List <WorkQueue .Entry >> queueEntriesByResult ) {
319- var childrenRequiringResourceLocks = queueEntriesByResult .remove (WorkStealResult .RESOURCE_LOCK_UNAVAILABLE );
320- if (childrenRequiringResourceLocks == null ) {
318+ var entriesRequiringResourceLocks = queueEntriesByResult .remove (WorkStealResult .RESOURCE_LOCK_UNAVAILABLE );
319+ if (entriesRequiringResourceLocks == null ) {
321320 return ;
322321 }
323- tryToStealWork (childrenRequiringResourceLocks , BlockingMode .BLOCKING , queueEntriesByResult );
322+ tryToStealWork (entriesRequiringResourceLocks , BlockingMode .BLOCKING , queueEntriesByResult );
324323 }
325324
326- private void tryToStealWork (List <WorkQueue .Entry > children , BlockingMode blocking ,
325+ private void tryToStealWork (List <WorkQueue .Entry > entries , BlockingMode blocking ,
327326 Map <WorkStealResult , List <WorkQueue .Entry >> queueEntriesByResult ) {
328- for (var entry : children ) {
327+ for (var entry : entries ) {
329328 var state = tryToStealWork (entry , blocking );
330329 queueEntriesByResult .computeIfAbsent (state , __ -> new ArrayList <>()).add (entry );
331330 }
0 commit comments