ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/RecursiveActionTest.java
(Generate patch)

Comparing jsr166/src/test/tck/RecursiveActionTest.java (file contents):
Revision 1.6 by jsr166, Tue Aug 4 10:13:48 2009 UTC vs.
Revision 1.7 by jsr166, Wed Aug 5 01:17:30 2009 UTC

# Line 72 | Line 72 | public class RecursiveActionTest extends
72       */
73      public void testInvoke() {
74          RecursiveAction a = new RecursiveAction() {
75 <                public void compute() {
76 <                    FibAction f = new FibAction(8);
77 <                    f.invoke();
78 <                    threadAssertTrue(f.result == 21);
79 <                    threadAssertTrue(f.isDone());
80 <                    threadAssertFalse(f.isCancelled());
81 <                    threadAssertFalse(f.isCompletedAbnormally());
82 <                    threadAssertTrue(f.getRawResult() == null);
83 <                }
84 <            };
75 >            public void compute() {
76 >                FibAction f = new FibAction(8);
77 >                f.invoke();
78 >                threadAssertTrue(f.result == 21);
79 >                threadAssertTrue(f.isDone());
80 >                threadAssertFalse(f.isCancelled());
81 >                threadAssertFalse(f.isCompletedAbnormally());
82 >                threadAssertTrue(f.getRawResult() == null);
83 >            }};
84          mainPool.invoke(a);
85      }
86  
# Line 92 | Line 91 | public class RecursiveActionTest extends
91       */
92      public void testQuietlyInvoke() {
93          RecursiveAction a = new RecursiveAction() {
94 <                public void compute() {
95 <                    FibAction f = new FibAction(8);
96 <                    f.quietlyInvoke();
97 <                    threadAssertTrue(f.result == 21);
98 <                    threadAssertTrue(f.isDone());
99 <                    threadAssertFalse(f.isCancelled());
100 <                    threadAssertFalse(f.isCompletedAbnormally());
101 <                    threadAssertTrue(f.getRawResult() == null);
102 <                }
104 <            };
94 >            public void compute() {
95 >                FibAction f = new FibAction(8);
96 >                f.quietlyInvoke();
97 >                threadAssertTrue(f.result == 21);
98 >                threadAssertTrue(f.isDone());
99 >                threadAssertFalse(f.isCancelled());
100 >                threadAssertFalse(f.isCompletedAbnormally());
101 >                threadAssertTrue(f.getRawResult() == null);
102 >            }};
103          mainPool.invoke(a);
104      }
105  
# Line 110 | Line 108 | public class RecursiveActionTest extends
108       */
109      public void testForkJoin() {
110          RecursiveAction a = new RecursiveAction() {
111 <                public void compute() {
112 <                    FibAction f = new FibAction(8);
113 <                    f.fork();
114 <                    f.join();
115 <                    threadAssertTrue(f.result == 21);
116 <                    threadAssertTrue(f.isDone());
117 <                    threadAssertTrue(f.getRawResult() == null);
118 <                }
121 <            };
111 >            public void compute() {
112 >                FibAction f = new FibAction(8);
113 >                f.fork();
114 >                f.join();
115 >                threadAssertTrue(f.result == 21);
116 >                threadAssertTrue(f.isDone());
117 >                threadAssertTrue(f.getRawResult() == null);
118 >            }};
119          mainPool.invoke(a);
120      }
121  
# Line 127 | Line 124 | public class RecursiveActionTest extends
124       */
125      public void testForkGet() {
126          RecursiveAction a = new RecursiveAction() {
127 <                public void compute() {
128 <                    try {
129 <                        FibAction f = new FibAction(8);
130 <                        f.fork();
131 <                        f.get();
132 <                        threadAssertTrue(f.result == 21);
133 <                        threadAssertTrue(f.isDone());
134 <                    } catch (Exception ex) {
135 <                        unexpectedException(ex);
139 <                    }
127 >            public void compute() {
128 >                try {
129 >                    FibAction f = new FibAction(8);
130 >                    f.fork();
131 >                    f.get();
132 >                    threadAssertTrue(f.result == 21);
133 >                    threadAssertTrue(f.isDone());
134 >                } catch (Exception ex) {
135 >                    unexpectedException(ex);
136                  }
137 <            };
137 >            }};
138          mainPool.invoke(a);
139      }
140  
# Line 147 | Line 143 | public class RecursiveActionTest extends
143       */
144      public void testForkTimedGet() {
145          RecursiveAction a = new RecursiveAction() {
146 <                public void compute() {
147 <                    try {
148 <                        FibAction f = new FibAction(8);
149 <                        f.fork();
150 <                        f.get(5L, TimeUnit.SECONDS);
151 <                        threadAssertTrue(f.result == 21);
152 <                        threadAssertTrue(f.isDone());
153 <                    } catch (Exception ex) {
154 <                        unexpectedException(ex);
159 <                    }
146 >            public void compute() {
147 >                try {
148 >                    FibAction f = new FibAction(8);
149 >                    f.fork();
150 >                    f.get(5L, TimeUnit.SECONDS);
151 >                    threadAssertTrue(f.result == 21);
152 >                    threadAssertTrue(f.isDone());
153 >                } catch (Exception ex) {
154 >                    unexpectedException(ex);
155                  }
156 <            };
156 >            }};
157          mainPool.invoke(a);
158      }
159  
# Line 187 | Line 182 | public class RecursiveActionTest extends
182       */
183      public void testForkHelpJoin() {
184          RecursiveAction a = new RecursiveAction() {
185 <                public void compute() {
186 <                    FibAction f = new FibAction(8);
187 <                    f.fork();
188 <                    f.helpJoin();
189 <                    threadAssertTrue(f.result == 21);
190 <                    threadAssertTrue(f.isDone());
191 <                }
197 <            };
185 >            public void compute() {
186 >                FibAction f = new FibAction(8);
187 >                f.fork();
188 >                f.helpJoin();
189 >                threadAssertTrue(f.result == 21);
190 >                threadAssertTrue(f.isDone());
191 >            }};
192          mainPool.invoke(a);
193      }
194  
# Line 203 | Line 197 | public class RecursiveActionTest extends
197       */
198      public void testForkQuietlyJoin() {
199          RecursiveAction a = new RecursiveAction() {
200 <                public void compute() {
201 <                    FibAction f = new FibAction(8);
202 <                    f.fork();
203 <                    f.quietlyJoin();
204 <                    threadAssertTrue(f.result == 21);
205 <                    threadAssertTrue(f.isDone());
206 <                }
213 <            };
200 >            public void compute() {
201 >                FibAction f = new FibAction(8);
202 >                f.fork();
203 >                f.quietlyJoin();
204 >                threadAssertTrue(f.result == 21);
205 >                threadAssertTrue(f.isDone());
206 >            }};
207          mainPool.invoke(a);
208      }
209  
# Line 220 | Line 213 | public class RecursiveActionTest extends
213       */
214      public void testForkQuietlyHelpJoin() {
215          RecursiveAction a = new RecursiveAction() {
216 <                public void compute() {
217 <                    FibAction f = new FibAction(8);
218 <                    f.fork();
219 <                    f.quietlyHelpJoin();
220 <                    threadAssertTrue(f.result == 21);
221 <                    threadAssertTrue(f.isDone());
222 <                }
230 <            };
216 >            public void compute() {
217 >                FibAction f = new FibAction(8);
218 >                f.fork();
219 >                f.quietlyHelpJoin();
220 >                threadAssertTrue(f.result == 21);
221 >                threadAssertTrue(f.isDone());
222 >            }};
223          mainPool.invoke(a);
224      }
225  
# Line 238 | Line 230 | public class RecursiveActionTest extends
230       */
231      public void testForkHelpQuiesce() {
232          RecursiveAction a = new RecursiveAction() {
233 <                public void compute() {
234 <                    FibAction f = new FibAction(8);
235 <                    f.fork();
236 <                    f.helpQuiesce();
237 <                    threadAssertTrue(f.result == 21);
238 <                    threadAssertTrue(f.isDone());
239 <                    threadAssertTrue(getQueuedTaskCount() == 0);
240 <                }
249 <            };
233 >            public void compute() {
234 >                FibAction f = new FibAction(8);
235 >                f.fork();
236 >                f.helpQuiesce();
237 >                threadAssertTrue(f.result == 21);
238 >                threadAssertTrue(f.isDone());
239 >                threadAssertTrue(getQueuedTaskCount() == 0);
240 >            }};
241          mainPool.invoke(a);
242      }
243  
# Line 256 | Line 247 | public class RecursiveActionTest extends
247       */
248      public void testAbnormalInvoke() {
249          RecursiveAction a = new RecursiveAction() {
250 <                public void compute() {
251 <                    try {
252 <                        FailingFibAction f = new FailingFibAction(8);
253 <                        f.invoke();
254 <                        shouldThrow();
255 <                    } catch (FJException success) {
265 <                    }
250 >            public void compute() {
251 >                try {
252 >                    FailingFibAction f = new FailingFibAction(8);
253 >                    f.invoke();
254 >                    shouldThrow();
255 >                } catch (FJException success) {
256                  }
257 <            };
257 >            }};
258          mainPool.invoke(a);
259      }
260  
# Line 273 | Line 263 | public class RecursiveActionTest extends
263       */
264      public void testAbnormalQuietlyInvoke() {
265          RecursiveAction a = new RecursiveAction() {
266 <                public void compute() {
267 <                    FailingFibAction f = new FailingFibAction(8);
268 <                    f.quietlyInvoke();
269 <                    threadAssertTrue(f.isDone());
270 <                }
281 <            };
266 >            public void compute() {
267 >                FailingFibAction f = new FailingFibAction(8);
268 >                f.quietlyInvoke();
269 >                threadAssertTrue(f.isDone());
270 >            }};
271          mainPool.invoke(a);
272      }
273  
# Line 287 | Line 276 | public class RecursiveActionTest extends
276       */
277      public void testAbnormalForkJoin() {
278          RecursiveAction a = new RecursiveAction() {
279 <                public void compute() {
280 <                    try {
281 <                        FailingFibAction f = new FailingFibAction(8);
282 <                        f.fork();
283 <                        f.join();
284 <                        shouldThrow();
285 <                    } catch (FJException success) {
297 <                    }
279 >            public void compute() {
280 >                try {
281 >                    FailingFibAction f = new FailingFibAction(8);
282 >                    f.fork();
283 >                    f.join();
284 >                    shouldThrow();
285 >                } catch (FJException success) {
286                  }
287 <            };
287 >            }};
288          mainPool.invoke(a);
289      }
290  
# Line 305 | Line 293 | public class RecursiveActionTest extends
293       */
294      public void testAbnormalForkGet() {
295          RecursiveAction a = new RecursiveAction() {
296 <                public void compute() {
297 <                    try {
298 <                        FailingFibAction f = new FailingFibAction(8);
299 <                        f.fork();
300 <                        f.get();
301 <                        shouldThrow();
302 <                    } catch (ExecutionException success) {
303 <                    } catch (Exception ex) {
304 <                        unexpectedException(ex);
317 <                    }
296 >            public void compute() {
297 >                try {
298 >                    FailingFibAction f = new FailingFibAction(8);
299 >                    f.fork();
300 >                    f.get();
301 >                    shouldThrow();
302 >                } catch (ExecutionException success) {
303 >                } catch (Exception ex) {
304 >                    unexpectedException(ex);
305                  }
306 <            };
306 >            }};
307          mainPool.invoke(a);
308      }
309  
# Line 325 | Line 312 | public class RecursiveActionTest extends
312       */
313      public void testAbnormalForkTimedGet() {
314          RecursiveAction a = new RecursiveAction() {
315 <                public void compute() {
316 <                    try {
317 <                        FailingFibAction f = new FailingFibAction(8);
318 <                        f.fork();
319 <                        f.get(5L, TimeUnit.SECONDS);
320 <                        shouldThrow();
321 <                    } catch (ExecutionException success) {
322 <                    } catch (Exception ex) {
323 <                        unexpectedException(ex);
337 <                    }
315 >            public void compute() {
316 >                try {
317 >                    FailingFibAction f = new FailingFibAction(8);
318 >                    f.fork();
319 >                    f.get(5L, TimeUnit.SECONDS);
320 >                    shouldThrow();
321 >                } catch (ExecutionException success) {
322 >                } catch (Exception ex) {
323 >                    unexpectedException(ex);
324                  }
325 <            };
325 >            }};
326          mainPool.invoke(a);
327      }
328  
# Line 345 | Line 331 | public class RecursiveActionTest extends
331       */
332      public void testAbnormalForkHelpJoin() {
333          RecursiveAction a = new RecursiveAction() {
334 <                public void compute() {
335 <                    try {
336 <                        FailingFibAction f = new FailingFibAction(8);
337 <                        f.fork();
338 <                        f.helpJoin();
339 <                        shouldThrow();
340 <                    } catch (FJException success) {
355 <                    }
334 >            public void compute() {
335 >                try {
336 >                    FailingFibAction f = new FailingFibAction(8);
337 >                    f.fork();
338 >                    f.helpJoin();
339 >                    shouldThrow();
340 >                } catch (FJException success) {
341                  }
342 <            };
342 >            }};
343          mainPool.invoke(a);
344      }
345  
# Line 366 | Line 351 | public class RecursiveActionTest extends
351       */
352      public void testAbnormalForkQuietlyHelpJoin() {
353          RecursiveAction a = new RecursiveAction() {
354 <                public void compute() {
355 <                    FailingFibAction f = new FailingFibAction(8);
356 <                    f.fork();
357 <                    f.quietlyHelpJoin();
358 <                    threadAssertTrue(f.isDone());
359 <                    threadAssertTrue(f.isCompletedAbnormally());
360 <                    threadAssertFalse(f.isCancelled());
361 <                    threadAssertTrue(f.getException() instanceof FJException);
362 <                }
378 <            };
354 >            public void compute() {
355 >                FailingFibAction f = new FailingFibAction(8);
356 >                f.fork();
357 >                f.quietlyHelpJoin();
358 >                threadAssertTrue(f.isDone());
359 >                threadAssertTrue(f.isCompletedAbnormally());
360 >                threadAssertFalse(f.isCancelled());
361 >                threadAssertTrue(f.getException() instanceof FJException);
362 >            }};
363          mainPool.invoke(a);
364      }
365  
# Line 384 | Line 368 | public class RecursiveActionTest extends
368       */
369      public void testAbnormalForkQuietlyJoin() {
370          RecursiveAction a = new RecursiveAction() {
371 <                public void compute() {
372 <                    FailingFibAction f = new FailingFibAction(8);
373 <                    f.fork();
374 <                    f.quietlyJoin();
375 <                    threadAssertTrue(f.isDone());
376 <                    threadAssertTrue(f.isCompletedAbnormally());
377 <                    threadAssertTrue(f.getException() instanceof FJException);
378 <                }
395 <            };
371 >            public void compute() {
372 >                FailingFibAction f = new FailingFibAction(8);
373 >                f.fork();
374 >                f.quietlyJoin();
375 >                threadAssertTrue(f.isDone());
376 >                threadAssertTrue(f.isCompletedAbnormally());
377 >                threadAssertTrue(f.getException() instanceof FJException);
378 >            }};
379          mainPool.invoke(a);
380      }
381  
# Line 401 | Line 384 | public class RecursiveActionTest extends
384       */
385      public void testCancelledInvoke() {
386          RecursiveAction a = new RecursiveAction() {
387 <                public void compute() {
388 <                    try {
389 <                        FibAction f = new FibAction(8);
390 <                        f.cancel(true);
391 <                        f.invoke();
392 <                        shouldThrow();
393 <                    } catch (CancellationException success) {
411 <                    }
387 >            public void compute() {
388 >                try {
389 >                    FibAction f = new FibAction(8);
390 >                    f.cancel(true);
391 >                    f.invoke();
392 >                    shouldThrow();
393 >                } catch (CancellationException success) {
394                  }
395 <            };
395 >            }};
396          mainPool.invoke(a);
397      }
398  
# Line 419 | Line 401 | public class RecursiveActionTest extends
401       */
402      public void testCancelledForkJoin() {
403          RecursiveAction a = new RecursiveAction() {
404 <                public void compute() {
405 <                    try {
406 <                        FibAction f = new FibAction(8);
407 <                        f.cancel(true);
408 <                        f.fork();
409 <                        f.join();
410 <                        shouldThrow();
411 <                    } catch (CancellationException success) {
430 <                    }
404 >            public void compute() {
405 >                try {
406 >                    FibAction f = new FibAction(8);
407 >                    f.cancel(true);
408 >                    f.fork();
409 >                    f.join();
410 >                    shouldThrow();
411 >                } catch (CancellationException success) {
412                  }
413 <            };
413 >            }};
414          mainPool.invoke(a);
415      }
416  
# Line 438 | Line 419 | public class RecursiveActionTest extends
419       */
420      public void testCancelledForkGet() {
421          RecursiveAction a = new RecursiveAction() {
422 <                public void compute() {
423 <                    try {
424 <                        FibAction f = new FibAction(8);
425 <                        f.cancel(true);
426 <                        f.fork();
427 <                        f.get();
428 <                        shouldThrow();
429 <                    } catch (CancellationException success) {
430 <                    } catch (Exception ex) {
431 <                        unexpectedException(ex);
451 <                    }
422 >            public void compute() {
423 >                try {
424 >                    FibAction f = new FibAction(8);
425 >                    f.cancel(true);
426 >                    f.fork();
427 >                    f.get();
428 >                    shouldThrow();
429 >                } catch (CancellationException success) {
430 >                } catch (Exception ex) {
431 >                    unexpectedException(ex);
432                  }
433 <            };
433 >            }};
434          mainPool.invoke(a);
435      }
436  
# Line 459 | Line 439 | public class RecursiveActionTest extends
439       */
440      public void testCancelledForkTimedGet() {
441          RecursiveAction a = new RecursiveAction() {
442 <                public void compute() {
443 <                    try {
444 <                        FibAction f = new FibAction(8);
445 <                        f.cancel(true);
446 <                        f.fork();
447 <                        f.get(5L, TimeUnit.SECONDS);
448 <                        shouldThrow();
449 <                    } catch (CancellationException success) {
450 <                    } catch (Exception ex) {
451 <                        unexpectedException(ex);
472 <                    }
442 >            public void compute() {
443 >                try {
444 >                    FibAction f = new FibAction(8);
445 >                    f.cancel(true);
446 >                    f.fork();
447 >                    f.get(5L, TimeUnit.SECONDS);
448 >                    shouldThrow();
449 >                } catch (CancellationException success) {
450 >                } catch (Exception ex) {
451 >                    unexpectedException(ex);
452                  }
453 <            };
453 >            }};
454          mainPool.invoke(a);
455      }
456  
# Line 480 | Line 459 | public class RecursiveActionTest extends
459       */
460      public void testCancelledForkHelpJoin() {
461          RecursiveAction a = new RecursiveAction() {
462 <                public void compute() {
463 <                    try {
464 <                        FibAction f = new FibAction(8);
465 <                        f.cancel(true);
466 <                        f.fork();
467 <                        f.helpJoin();
468 <                        shouldThrow();
469 <                    } catch (CancellationException success) {
491 <                    }
462 >            public void compute() {
463 >                try {
464 >                    FibAction f = new FibAction(8);
465 >                    f.cancel(true);
466 >                    f.fork();
467 >                    f.helpJoin();
468 >                    shouldThrow();
469 >                } catch (CancellationException success) {
470                  }
471 <            };
471 >            }};
472          mainPool.invoke(a);
473      }
474  
# Line 502 | Line 480 | public class RecursiveActionTest extends
480       */
481      public void testCancelledForkQuietlyHelpJoin() {
482          RecursiveAction a = new RecursiveAction() {
483 <                public void compute() {
484 <                    FibAction f = new FibAction(8);
485 <                    f.cancel(true);
486 <                    f.fork();
487 <                    f.quietlyHelpJoin();
488 <                    threadAssertTrue(f.isDone());
489 <                    threadAssertTrue(f.isCompletedAbnormally());
490 <                    threadAssertTrue(f.isCancelled());
491 <                    threadAssertTrue(f.getException() instanceof CancellationException);
492 <                }
515 <            };
483 >            public void compute() {
484 >                FibAction f = new FibAction(8);
485 >                f.cancel(true);
486 >                f.fork();
487 >                f.quietlyHelpJoin();
488 >                threadAssertTrue(f.isDone());
489 >                threadAssertTrue(f.isCompletedAbnormally());
490 >                threadAssertTrue(f.isCancelled());
491 >                threadAssertTrue(f.getException() instanceof CancellationException);
492 >            }};
493          mainPool.invoke(a);
494      }
495  
# Line 521 | Line 498 | public class RecursiveActionTest extends
498       */
499      public void testCancelledForkQuietlyJoin() {
500          RecursiveAction a = new RecursiveAction() {
501 <                public void compute() {
502 <                    FibAction f = new FibAction(8);
503 <                    f.cancel(true);
504 <                    f.fork();
505 <                    f.quietlyJoin();
506 <                    threadAssertTrue(f.isDone());
507 <                    threadAssertTrue(f.isCompletedAbnormally());
508 <                    threadAssertTrue(f.getException() instanceof CancellationException);
509 <                }
533 <            };
501 >            public void compute() {
502 >                FibAction f = new FibAction(8);
503 >                f.cancel(true);
504 >                f.fork();
505 >                f.quietlyJoin();
506 >                threadAssertTrue(f.isDone());
507 >                threadAssertTrue(f.isCompletedAbnormally());
508 >                threadAssertTrue(f.getException() instanceof CancellationException);
509 >            }};
510          mainPool.invoke(a);
511      }
512  
# Line 539 | Line 515 | public class RecursiveActionTest extends
515       */
516      public void testGetPool() {
517          RecursiveAction a = new RecursiveAction() {
518 <                public void compute() {
519 <                    threadAssertTrue(getPool() == mainPool);
520 <                }
545 <            };
518 >            public void compute() {
519 >                threadAssertTrue(getPool() == mainPool);
520 >            }};
521          mainPool.invoke(a);
522      }
523  
# Line 551 | Line 526 | public class RecursiveActionTest extends
526       */
527      public void testGetPool2() {
528          RecursiveAction a = new RecursiveAction() {
529 <                public void compute() {
530 <                    threadAssertTrue(getPool() == null);
531 <                }
557 <            };
529 >            public void compute() {
530 >                threadAssertTrue(getPool() == null);
531 >            }};
532          a.invoke();
533      }
534  
# Line 563 | Line 537 | public class RecursiveActionTest extends
537       */
538      public void testInForkJoinPool() {
539          RecursiveAction a = new RecursiveAction() {
540 <                public void compute() {
541 <                    threadAssertTrue(inForkJoinPool());
542 <                }
569 <            };
540 >            public void compute() {
541 >                threadAssertTrue(inForkJoinPool());
542 >            }};
543          mainPool.invoke(a);
544      }
545  
# Line 575 | Line 548 | public class RecursiveActionTest extends
548       */
549      public void testInForkJoinPool2() {
550          RecursiveAction a = new RecursiveAction() {
551 <                public void compute() {
552 <                    threadAssertTrue(!inForkJoinPool());
553 <                }
581 <            };
551 >            public void compute() {
552 >                threadAssertTrue(!inForkJoinPool());
553 >            }};
554          a.invoke();
555      }
556  
# Line 587 | Line 559 | public class RecursiveActionTest extends
559       */
560      public void testWorkerGetPool() {
561          RecursiveAction a = new RecursiveAction() {
562 <                public void compute() {
563 <                    ForkJoinWorkerThread w =
564 <                        (ForkJoinWorkerThread)(Thread.currentThread());
565 <                    threadAssertTrue(w.getPool() == mainPool);
566 <                }
595 <            };
562 >            public void compute() {
563 >                ForkJoinWorkerThread w =
564 >                    (ForkJoinWorkerThread)(Thread.currentThread());
565 >                threadAssertTrue(w.getPool() == mainPool);
566 >            }};
567          mainPool.invoke(a);
568      }
569  
# Line 602 | Line 573 | public class RecursiveActionTest extends
573       */
574      public void testWorkerGetPoolIndex() {
575          RecursiveAction a = new RecursiveAction() {
576 <                public void compute() {
577 <                    ForkJoinWorkerThread w =
578 <                        (ForkJoinWorkerThread)(Thread.currentThread());
579 <                    int idx = w.getPoolIndex();
580 <                    threadAssertTrue(idx >= 0);
581 <                    threadAssertTrue(idx < mainPool.getPoolSize());
582 <                }
612 <            };
576 >            public void compute() {
577 >                ForkJoinWorkerThread w =
578 >                    (ForkJoinWorkerThread)(Thread.currentThread());
579 >                int idx = w.getPoolIndex();
580 >                threadAssertTrue(idx >= 0);
581 >                threadAssertTrue(idx < mainPool.getPoolSize());
582 >            }};
583          mainPool.invoke(a);
584      }
585  
# Line 619 | Line 589 | public class RecursiveActionTest extends
589       */
590      public void testSetRawResult() {
591          RecursiveAction a = new RecursiveAction() {
592 <                public void compute() {
593 <                    setRawResult(null);
594 <                }
625 <            };
592 >            public void compute() {
593 >                setRawResult(null);
594 >            }};
595          a.invoke();
596      }
597  
# Line 631 | Line 600 | public class RecursiveActionTest extends
600       */
601      public void testReinitialize() {
602          RecursiveAction a = new RecursiveAction() {
603 <                public void compute() {
604 <                    FibAction f = new FibAction(8);
605 <                    f.invoke();
606 <                    threadAssertTrue(f.result == 21);
607 <                    threadAssertTrue(f.isDone());
608 <                    threadAssertFalse(f.isCancelled());
609 <                    threadAssertFalse(f.isCompletedAbnormally());
610 <                    f.reinitialize();
611 <                    f.invoke();
612 <                    threadAssertTrue(f.result == 21);
613 <                }
645 <            };
603 >            public void compute() {
604 >                FibAction f = new FibAction(8);
605 >                f.invoke();
606 >                threadAssertTrue(f.result == 21);
607 >                threadAssertTrue(f.isDone());
608 >                threadAssertFalse(f.isCancelled());
609 >                threadAssertFalse(f.isCompletedAbnormally());
610 >                f.reinitialize();
611 >                f.invoke();
612 >                threadAssertTrue(f.result == 21);
613 >            }};
614          mainPool.invoke(a);
615      }
616  
# Line 651 | Line 619 | public class RecursiveActionTest extends
619       */
620      public void testCompleteExceptionally() {
621          RecursiveAction a = new RecursiveAction() {
622 <                public void compute() {
623 <                    try {
624 <                        FibAction f = new FibAction(8);
625 <                        f.completeExceptionally(new FJException());
626 <                        f.invoke();
627 <                        shouldThrow();
628 <                    } catch (FJException success) {
661 <                    }
622 >            public void compute() {
623 >                try {
624 >                    FibAction f = new FibAction(8);
625 >                    f.completeExceptionally(new FJException());
626 >                    f.invoke();
627 >                    shouldThrow();
628 >                } catch (FJException success) {
629                  }
630 <            };
630 >            }};
631          mainPool.invoke(a);
632      }
633  
# Line 669 | Line 636 | public class RecursiveActionTest extends
636       */
637      public void testComplete() {
638          RecursiveAction a = new RecursiveAction() {
639 <                public void compute() {
640 <                    FibAction f = new FibAction(8);
641 <                    f.complete(null);
642 <                    f.invoke();
643 <                    threadAssertTrue(f.isDone());
644 <                    threadAssertTrue(f.result == 0);
645 <                }
679 <            };
639 >            public void compute() {
640 >                FibAction f = new FibAction(8);
641 >                f.complete(null);
642 >                f.invoke();
643 >                threadAssertTrue(f.isDone());
644 >                threadAssertTrue(f.result == 0);
645 >            }};
646          mainPool.invoke(a);
647      }
648  
# Line 685 | Line 651 | public class RecursiveActionTest extends
651       */
652      public void testInvokeAll2() {
653          RecursiveAction a = new RecursiveAction() {
654 <                public void compute() {
655 <                    FibAction f = new FibAction(8);
656 <                    FibAction g = new FibAction(9);
657 <                    invokeAll(f, g);
658 <                    threadAssertTrue(f.isDone());
659 <                    threadAssertTrue(f.result == 21);
660 <                    threadAssertTrue(g.isDone());
661 <                    threadAssertTrue(g.result == 34);
662 <                }
697 <            };
654 >            public void compute() {
655 >                FibAction f = new FibAction(8);
656 >                FibAction g = new FibAction(9);
657 >                invokeAll(f, g);
658 >                threadAssertTrue(f.isDone());
659 >                threadAssertTrue(f.result == 21);
660 >                threadAssertTrue(g.isDone());
661 >                threadAssertTrue(g.result == 34);
662 >            }};
663          mainPool.invoke(a);
664      }
665  
# Line 703 | Line 668 | public class RecursiveActionTest extends
668       */
669      public void testInvokeAll1() {
670          RecursiveAction a = new RecursiveAction() {
671 <                public void compute() {
672 <                    FibAction f = new FibAction(8);
673 <                    invokeAll(f);
674 <                    threadAssertTrue(f.isDone());
675 <                    threadAssertTrue(f.result == 21);
676 <                }
712 <            };
671 >            public void compute() {
672 >                FibAction f = new FibAction(8);
673 >                invokeAll(f);
674 >                threadAssertTrue(f.isDone());
675 >                threadAssertTrue(f.result == 21);
676 >            }};
677          mainPool.invoke(a);
678      }
679  
# Line 718 | Line 682 | public class RecursiveActionTest extends
682       */
683      public void testInvokeAll3() {
684          RecursiveAction a = new RecursiveAction() {
685 <                public void compute() {
686 <                    FibAction f = new FibAction(8);
687 <                    FibAction g = new FibAction(9);
688 <                    FibAction h = new FibAction(7);
689 <                    invokeAll(f, g, h);
690 <                    threadAssertTrue(f.isDone());
691 <                    threadAssertTrue(f.result == 21);
692 <                    threadAssertTrue(g.isDone());
693 <                    threadAssertTrue(g.result == 34);
694 <                    threadAssertTrue(h.isDone());
695 <                    threadAssertTrue(h.result == 13);
696 <                }
733 <            };
685 >            public void compute() {
686 >                FibAction f = new FibAction(8);
687 >                FibAction g = new FibAction(9);
688 >                FibAction h = new FibAction(7);
689 >                invokeAll(f, g, h);
690 >                threadAssertTrue(f.isDone());
691 >                threadAssertTrue(f.result == 21);
692 >                threadAssertTrue(g.isDone());
693 >                threadAssertTrue(g.result == 34);
694 >                threadAssertTrue(h.isDone());
695 >                threadAssertTrue(h.result == 13);
696 >            }};
697          mainPool.invoke(a);
698      }
699  
# Line 739 | Line 702 | public class RecursiveActionTest extends
702       */
703      public void testInvokeAllCollection() {
704          RecursiveAction a = new RecursiveAction() {
705 <                public void compute() {
706 <                    FibAction f = new FibAction(8);
707 <                    FibAction g = new FibAction(9);
708 <                    FibAction h = new FibAction(7);
709 <                    HashSet set = new HashSet();
710 <                    set.add(f);
711 <                    set.add(g);
712 <                    set.add(h);
713 <                    invokeAll(set);
714 <                    threadAssertTrue(f.isDone());
715 <                    threadAssertTrue(f.result == 21);
716 <                    threadAssertTrue(g.isDone());
717 <                    threadAssertTrue(g.result == 34);
718 <                    threadAssertTrue(h.isDone());
719 <                    threadAssertTrue(h.result == 13);
720 <                }
758 <            };
705 >            public void compute() {
706 >                FibAction f = new FibAction(8);
707 >                FibAction g = new FibAction(9);
708 >                FibAction h = new FibAction(7);
709 >                HashSet set = new HashSet();
710 >                set.add(f);
711 >                set.add(g);
712 >                set.add(h);
713 >                invokeAll(set);
714 >                threadAssertTrue(f.isDone());
715 >                threadAssertTrue(f.result == 21);
716 >                threadAssertTrue(g.isDone());
717 >                threadAssertTrue(g.result == 34);
718 >                threadAssertTrue(h.isDone());
719 >                threadAssertTrue(h.result == 13);
720 >            }};
721          mainPool.invoke(a);
722      }
723  
# Line 765 | Line 727 | public class RecursiveActionTest extends
727       */
728      public void testInvokeAllNPE() {
729          RecursiveAction a = new RecursiveAction() {
730 <                public void compute() {
731 <                    try {
732 <                        FibAction f = new FibAction(8);
733 <                        FibAction g = new FibAction(9);
734 <                        FibAction h = null;
735 <                        invokeAll(f, g, h);
736 <                        shouldThrow();
737 <                    } catch (NullPointerException success) {
776 <                    }
730 >            public void compute() {
731 >                try {
732 >                    FibAction f = new FibAction(8);
733 >                    FibAction g = new FibAction(9);
734 >                    FibAction h = null;
735 >                    invokeAll(f, g, h);
736 >                    shouldThrow();
737 >                } catch (NullPointerException success) {
738                  }
739 <            };
739 >            }};
740          mainPool.invoke(a);
741      }
742  
# Line 784 | Line 745 | public class RecursiveActionTest extends
745       */
746      public void testAbnormalInvokeAll2() {
747          RecursiveAction a = new RecursiveAction() {
748 <                public void compute() {
749 <                    try {
750 <                        FibAction f = new FibAction(8);
751 <                        FailingFibAction g = new FailingFibAction(9);
752 <                        invokeAll(f, g);
753 <                        shouldThrow();
754 <                    } catch (FJException success) {
794 <                    }
748 >            public void compute() {
749 >                try {
750 >                    FibAction f = new FibAction(8);
751 >                    FailingFibAction g = new FailingFibAction(9);
752 >                    invokeAll(f, g);
753 >                    shouldThrow();
754 >                } catch (FJException success) {
755                  }
756 <            };
756 >            }};
757          mainPool.invoke(a);
758      }
759  
# Line 802 | Line 762 | public class RecursiveActionTest extends
762       */
763      public void testAbnormalInvokeAll1() {
764          RecursiveAction a = new RecursiveAction() {
765 <                public void compute() {
766 <                    try {
767 <                        FailingFibAction g = new FailingFibAction(9);
768 <                        invokeAll(g);
769 <                        shouldThrow();
770 <                    } catch (FJException success) {
811 <                    }
765 >            public void compute() {
766 >                try {
767 >                    FailingFibAction g = new FailingFibAction(9);
768 >                    invokeAll(g);
769 >                    shouldThrow();
770 >                } catch (FJException success) {
771                  }
772 <            };
772 >            }};
773          mainPool.invoke(a);
774      }
775  
# Line 819 | Line 778 | public class RecursiveActionTest extends
778       */
779      public void testAbnormalInvokeAll3() {
780          RecursiveAction a = new RecursiveAction() {
781 <                public void compute() {
782 <                    try {
783 <                        FibAction f = new FibAction(8);
784 <                        FailingFibAction g = new FailingFibAction(9);
785 <                        FibAction h = new FibAction(7);
786 <                        invokeAll(f, g, h);
787 <                        shouldThrow();
788 <                    } catch (FJException success) {
830 <                    }
781 >            public void compute() {
782 >                try {
783 >                    FibAction f = new FibAction(8);
784 >                    FailingFibAction g = new FailingFibAction(9);
785 >                    FibAction h = new FibAction(7);
786 >                    invokeAll(f, g, h);
787 >                    shouldThrow();
788 >                } catch (FJException success) {
789                  }
790 <            };
790 >            }};
791          mainPool.invoke(a);
792      }
793  
# Line 838 | Line 796 | public class RecursiveActionTest extends
796       */
797      public void testAbnormalInvokeAllCollection() {
798          RecursiveAction a = new RecursiveAction() {
799 <                public void compute() {
800 <                    try {
801 <                        FailingFibAction f = new FailingFibAction(8);
802 <                        FibAction g = new FibAction(9);
803 <                        FibAction h = new FibAction(7);
804 <                        HashSet set = new HashSet();
805 <                        set.add(f);
806 <                        set.add(g);
807 <                        set.add(h);
808 <                        invokeAll(set);
809 <                        shouldThrow();
810 <                    } catch (FJException success) {
853 <                    }
799 >            public void compute() {
800 >                try {
801 >                    FailingFibAction f = new FailingFibAction(8);
802 >                    FibAction g = new FibAction(9);
803 >                    FibAction h = new FibAction(7);
804 >                    HashSet set = new HashSet();
805 >                    set.add(f);
806 >                    set.add(g);
807 >                    set.add(h);
808 >                    invokeAll(set);
809 >                    shouldThrow();
810 >                } catch (FJException success) {
811                  }
812 <            };
812 >            }};
813          mainPool.invoke(a);
814      }
815  
# Line 862 | Line 819 | public class RecursiveActionTest extends
819       */
820      public void testTryUnfork() {
821          RecursiveAction a = new RecursiveAction() {
822 <                public void compute() {
823 <                    FibAction g = new FibAction(9);
824 <                    g.fork();
825 <                    FibAction f = new FibAction(8);
826 <                    f.fork();
827 <                    threadAssertTrue(f.tryUnfork());
828 <                    helpQuiesce();
829 <                    threadAssertFalse(f.isDone());
830 <                    threadAssertTrue(g.isDone());
831 <                }
875 <            };
822 >            public void compute() {
823 >                FibAction g = new FibAction(9);
824 >                g.fork();
825 >                FibAction f = new FibAction(8);
826 >                f.fork();
827 >                threadAssertTrue(f.tryUnfork());
828 >                helpQuiesce();
829 >                threadAssertFalse(f.isDone());
830 >                threadAssertTrue(g.isDone());
831 >            }};
832          singletonPool.invoke(a);
833      }
834  
# Line 882 | Line 838 | public class RecursiveActionTest extends
838       */
839      public void testGetSurplusQueuedTaskCount() {
840          RecursiveAction a = new RecursiveAction() {
841 <                public void compute() {
842 <                    FibAction h = new FibAction(7);
843 <                    h.fork();
844 <                    FibAction g = new FibAction(9);
845 <                    g.fork();
846 <                    FibAction f = new FibAction(8);
847 <                    f.fork();
848 <                    threadAssertTrue(getSurplusQueuedTaskCount() > 0);
849 <                    helpQuiesce();
850 <                }
895 <            };
841 >            public void compute() {
842 >                FibAction h = new FibAction(7);
843 >                h.fork();
844 >                FibAction g = new FibAction(9);
845 >                g.fork();
846 >                FibAction f = new FibAction(8);
847 >                f.fork();
848 >                threadAssertTrue(getSurplusQueuedTaskCount() > 0);
849 >                helpQuiesce();
850 >            }};
851          singletonPool.invoke(a);
852      }
853  
# Line 901 | Line 856 | public class RecursiveActionTest extends
856       */
857      public void testPeekNextLocalTask() {
858          RecursiveAction a = new RecursiveAction() {
859 <                public void compute() {
860 <                    FibAction g = new FibAction(9);
861 <                    g.fork();
862 <                    FibAction f = new FibAction(8);
863 <                    f.fork();
864 <                    threadAssertTrue(peekNextLocalTask() == f);
865 <                    f.join();
866 <                    threadAssertTrue(f.isDone());
867 <                    helpQuiesce();
868 <                }
914 <            };
859 >            public void compute() {
860 >                FibAction g = new FibAction(9);
861 >                g.fork();
862 >                FibAction f = new FibAction(8);
863 >                f.fork();
864 >                threadAssertTrue(peekNextLocalTask() == f);
865 >                f.join();
866 >                threadAssertTrue(f.isDone());
867 >                helpQuiesce();
868 >            }};
869          singletonPool.invoke(a);
870      }
871  
# Line 921 | Line 875 | public class RecursiveActionTest extends
875       */
876      public void testPollNextLocalTask() {
877          RecursiveAction a = new RecursiveAction() {
878 <                public void compute() {
879 <                    FibAction g = new FibAction(9);
880 <                    g.fork();
881 <                    FibAction f = new FibAction(8);
882 <                    f.fork();
883 <                    threadAssertTrue(pollNextLocalTask() == f);
884 <                    helpQuiesce();
885 <                    threadAssertFalse(f.isDone());
886 <                }
933 <            };
878 >            public void compute() {
879 >                FibAction g = new FibAction(9);
880 >                g.fork();
881 >                FibAction f = new FibAction(8);
882 >                f.fork();
883 >                threadAssertTrue(pollNextLocalTask() == f);
884 >                helpQuiesce();
885 >                threadAssertFalse(f.isDone());
886 >            }};
887          singletonPool.invoke(a);
888      }
889  
# Line 940 | Line 893 | public class RecursiveActionTest extends
893       */
894      public void testPollTask() {
895          RecursiveAction a = new RecursiveAction() {
896 <                public void compute() {
897 <                    FibAction g = new FibAction(9);
898 <                    g.fork();
899 <                    FibAction f = new FibAction(8);
900 <                    f.fork();
901 <                    threadAssertTrue(pollTask() == f);
902 <                    helpQuiesce();
903 <                    threadAssertFalse(f.isDone());
904 <                    threadAssertTrue(g.isDone());
905 <                }
953 <            };
896 >            public void compute() {
897 >                FibAction g = new FibAction(9);
898 >                g.fork();
899 >                FibAction f = new FibAction(8);
900 >                f.fork();
901 >                threadAssertTrue(pollTask() == f);
902 >                helpQuiesce();
903 >                threadAssertFalse(f.isDone());
904 >                threadAssertTrue(g.isDone());
905 >            }};
906          singletonPool.invoke(a);
907      }
908  
# Line 959 | Line 911 | public class RecursiveActionTest extends
911       */
912      public void testPeekNextLocalTaskAsync() {
913          RecursiveAction a = new RecursiveAction() {
914 <                public void compute() {
915 <                    FibAction g = new FibAction(9);
916 <                    g.fork();
917 <                    FibAction f = new FibAction(8);
918 <                    f.fork();
919 <                    threadAssertTrue(peekNextLocalTask() == g);
920 <                    f.join();
921 <                    helpQuiesce();
922 <                    threadAssertTrue(f.isDone());
923 <                }
972 <            };
914 >            public void compute() {
915 >                FibAction g = new FibAction(9);
916 >                g.fork();
917 >                FibAction f = new FibAction(8);
918 >                f.fork();
919 >                threadAssertTrue(peekNextLocalTask() == g);
920 >                f.join();
921 >                helpQuiesce();
922 >                threadAssertTrue(f.isDone());
923 >            }};
924          asyncSingletonPool.invoke(a);
925      }
926  
# Line 979 | Line 930 | public class RecursiveActionTest extends
930       */
931      public void testPollNextLocalTaskAsync() {
932          RecursiveAction a = new RecursiveAction() {
933 <                public void compute() {
934 <                    FibAction g = new FibAction(9);
935 <                    g.fork();
936 <                    FibAction f = new FibAction(8);
937 <                    f.fork();
938 <                    threadAssertTrue(pollNextLocalTask() == g);
939 <                    helpQuiesce();
940 <                    threadAssertTrue(f.isDone());
941 <                    threadAssertFalse(g.isDone());
942 <                }
992 <            };
933 >            public void compute() {
934 >                FibAction g = new FibAction(9);
935 >                g.fork();
936 >                FibAction f = new FibAction(8);
937 >                f.fork();
938 >                threadAssertTrue(pollNextLocalTask() == g);
939 >                helpQuiesce();
940 >                threadAssertTrue(f.isDone());
941 >                threadAssertFalse(g.isDone());
942 >            }};
943          asyncSingletonPool.invoke(a);
944      }
945  
# Line 999 | Line 949 | public class RecursiveActionTest extends
949       */
950      public void testPollTaskAsync() {
951          RecursiveAction a = new RecursiveAction() {
952 <                public void compute() {
953 <                    FibAction g = new FibAction(9);
954 <                    g.fork();
955 <                    FibAction f = new FibAction(8);
956 <                    f.fork();
957 <                    threadAssertTrue(pollTask() == g);
958 <                    helpQuiesce();
959 <                    threadAssertTrue(f.isDone());
960 <                    threadAssertFalse(g.isDone());
961 <                }
1012 <            };
952 >            public void compute() {
953 >                FibAction g = new FibAction(9);
954 >                g.fork();
955 >                FibAction f = new FibAction(8);
956 >                f.fork();
957 >                threadAssertTrue(pollTask() == g);
958 >                helpQuiesce();
959 >                threadAssertTrue(f.isDone());
960 >                threadAssertFalse(g.isDone());
961 >            }};
962          asyncSingletonPool.invoke(a);
963      }
964  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines