--- jsr166/src/test/tck/RecursiveActionTest.java 2009/08/04 10:13:48 1.6 +++ jsr166/src/test/tck/RecursiveActionTest.java 2009/08/05 01:17:30 1.7 @@ -72,16 +72,15 @@ public class RecursiveActionTest extends */ public void testInvoke() { RecursiveAction a = new RecursiveAction() { - public void compute() { - FibAction f = new FibAction(8); - f.invoke(); - threadAssertTrue(f.result == 21); - threadAssertTrue(f.isDone()); - threadAssertFalse(f.isCancelled()); - threadAssertFalse(f.isCompletedAbnormally()); - threadAssertTrue(f.getRawResult() == null); - } - }; + public void compute() { + FibAction f = new FibAction(8); + f.invoke(); + threadAssertTrue(f.result == 21); + threadAssertTrue(f.isDone()); + threadAssertFalse(f.isCancelled()); + threadAssertFalse(f.isCompletedAbnormally()); + threadAssertTrue(f.getRawResult() == null); + }}; mainPool.invoke(a); } @@ -92,16 +91,15 @@ public class RecursiveActionTest extends */ public void testQuietlyInvoke() { RecursiveAction a = new RecursiveAction() { - public void compute() { - FibAction f = new FibAction(8); - f.quietlyInvoke(); - threadAssertTrue(f.result == 21); - threadAssertTrue(f.isDone()); - threadAssertFalse(f.isCancelled()); - threadAssertFalse(f.isCompletedAbnormally()); - threadAssertTrue(f.getRawResult() == null); - } - }; + public void compute() { + FibAction f = new FibAction(8); + f.quietlyInvoke(); + threadAssertTrue(f.result == 21); + threadAssertTrue(f.isDone()); + threadAssertFalse(f.isCancelled()); + threadAssertFalse(f.isCompletedAbnormally()); + threadAssertTrue(f.getRawResult() == null); + }}; mainPool.invoke(a); } @@ -110,15 +108,14 @@ public class RecursiveActionTest extends */ public void testForkJoin() { RecursiveAction a = new RecursiveAction() { - public void compute() { - FibAction f = new FibAction(8); - f.fork(); - f.join(); - threadAssertTrue(f.result == 21); - threadAssertTrue(f.isDone()); - threadAssertTrue(f.getRawResult() == null); - } - }; + public void compute() { + FibAction f = new FibAction(8); + f.fork(); + f.join(); + threadAssertTrue(f.result == 21); + threadAssertTrue(f.isDone()); + threadAssertTrue(f.getRawResult() == null); + }}; mainPool.invoke(a); } @@ -127,18 +124,17 @@ public class RecursiveActionTest extends */ public void testForkGet() { RecursiveAction a = new RecursiveAction() { - public void compute() { - try { - FibAction f = new FibAction(8); - f.fork(); - f.get(); - threadAssertTrue(f.result == 21); - threadAssertTrue(f.isDone()); - } catch (Exception ex) { - unexpectedException(ex); - } + public void compute() { + try { + FibAction f = new FibAction(8); + f.fork(); + f.get(); + threadAssertTrue(f.result == 21); + threadAssertTrue(f.isDone()); + } catch (Exception ex) { + unexpectedException(ex); } - }; + }}; mainPool.invoke(a); } @@ -147,18 +143,17 @@ public class RecursiveActionTest extends */ public void testForkTimedGet() { RecursiveAction a = new RecursiveAction() { - public void compute() { - try { - FibAction f = new FibAction(8); - f.fork(); - f.get(5L, TimeUnit.SECONDS); - threadAssertTrue(f.result == 21); - threadAssertTrue(f.isDone()); - } catch (Exception ex) { - unexpectedException(ex); - } + public void compute() { + try { + FibAction f = new FibAction(8); + f.fork(); + f.get(5L, TimeUnit.SECONDS); + threadAssertTrue(f.result == 21); + threadAssertTrue(f.isDone()); + } catch (Exception ex) { + unexpectedException(ex); } - }; + }}; mainPool.invoke(a); } @@ -187,14 +182,13 @@ public class RecursiveActionTest extends */ public void testForkHelpJoin() { RecursiveAction a = new RecursiveAction() { - public void compute() { - FibAction f = new FibAction(8); - f.fork(); - f.helpJoin(); - threadAssertTrue(f.result == 21); - threadAssertTrue(f.isDone()); - } - }; + public void compute() { + FibAction f = new FibAction(8); + f.fork(); + f.helpJoin(); + threadAssertTrue(f.result == 21); + threadAssertTrue(f.isDone()); + }}; mainPool.invoke(a); } @@ -203,14 +197,13 @@ public class RecursiveActionTest extends */ public void testForkQuietlyJoin() { RecursiveAction a = new RecursiveAction() { - public void compute() { - FibAction f = new FibAction(8); - f.fork(); - f.quietlyJoin(); - threadAssertTrue(f.result == 21); - threadAssertTrue(f.isDone()); - } - }; + public void compute() { + FibAction f = new FibAction(8); + f.fork(); + f.quietlyJoin(); + threadAssertTrue(f.result == 21); + threadAssertTrue(f.isDone()); + }}; mainPool.invoke(a); } @@ -220,14 +213,13 @@ public class RecursiveActionTest extends */ public void testForkQuietlyHelpJoin() { RecursiveAction a = new RecursiveAction() { - public void compute() { - FibAction f = new FibAction(8); - f.fork(); - f.quietlyHelpJoin(); - threadAssertTrue(f.result == 21); - threadAssertTrue(f.isDone()); - } - }; + public void compute() { + FibAction f = new FibAction(8); + f.fork(); + f.quietlyHelpJoin(); + threadAssertTrue(f.result == 21); + threadAssertTrue(f.isDone()); + }}; mainPool.invoke(a); } @@ -238,15 +230,14 @@ public class RecursiveActionTest extends */ public void testForkHelpQuiesce() { RecursiveAction a = new RecursiveAction() { - public void compute() { - FibAction f = new FibAction(8); - f.fork(); - f.helpQuiesce(); - threadAssertTrue(f.result == 21); - threadAssertTrue(f.isDone()); - threadAssertTrue(getQueuedTaskCount() == 0); - } - }; + public void compute() { + FibAction f = new FibAction(8); + f.fork(); + f.helpQuiesce(); + threadAssertTrue(f.result == 21); + threadAssertTrue(f.isDone()); + threadAssertTrue(getQueuedTaskCount() == 0); + }}; mainPool.invoke(a); } @@ -256,15 +247,14 @@ public class RecursiveActionTest extends */ public void testAbnormalInvoke() { RecursiveAction a = new RecursiveAction() { - public void compute() { - try { - FailingFibAction f = new FailingFibAction(8); - f.invoke(); - shouldThrow(); - } catch (FJException success) { - } + public void compute() { + try { + FailingFibAction f = new FailingFibAction(8); + f.invoke(); + shouldThrow(); + } catch (FJException success) { } - }; + }}; mainPool.invoke(a); } @@ -273,12 +263,11 @@ public class RecursiveActionTest extends */ public void testAbnormalQuietlyInvoke() { RecursiveAction a = new RecursiveAction() { - public void compute() { - FailingFibAction f = new FailingFibAction(8); - f.quietlyInvoke(); - threadAssertTrue(f.isDone()); - } - }; + public void compute() { + FailingFibAction f = new FailingFibAction(8); + f.quietlyInvoke(); + threadAssertTrue(f.isDone()); + }}; mainPool.invoke(a); } @@ -287,16 +276,15 @@ public class RecursiveActionTest extends */ public void testAbnormalForkJoin() { RecursiveAction a = new RecursiveAction() { - public void compute() { - try { - FailingFibAction f = new FailingFibAction(8); - f.fork(); - f.join(); - shouldThrow(); - } catch (FJException success) { - } + public void compute() { + try { + FailingFibAction f = new FailingFibAction(8); + f.fork(); + f.join(); + shouldThrow(); + } catch (FJException success) { } - }; + }}; mainPool.invoke(a); } @@ -305,18 +293,17 @@ public class RecursiveActionTest extends */ public void testAbnormalForkGet() { RecursiveAction a = new RecursiveAction() { - public void compute() { - try { - FailingFibAction f = new FailingFibAction(8); - f.fork(); - f.get(); - shouldThrow(); - } catch (ExecutionException success) { - } catch (Exception ex) { - unexpectedException(ex); - } + public void compute() { + try { + FailingFibAction f = new FailingFibAction(8); + f.fork(); + f.get(); + shouldThrow(); + } catch (ExecutionException success) { + } catch (Exception ex) { + unexpectedException(ex); } - }; + }}; mainPool.invoke(a); } @@ -325,18 +312,17 @@ public class RecursiveActionTest extends */ public void testAbnormalForkTimedGet() { RecursiveAction a = new RecursiveAction() { - public void compute() { - try { - FailingFibAction f = new FailingFibAction(8); - f.fork(); - f.get(5L, TimeUnit.SECONDS); - shouldThrow(); - } catch (ExecutionException success) { - } catch (Exception ex) { - unexpectedException(ex); - } + public void compute() { + try { + FailingFibAction f = new FailingFibAction(8); + f.fork(); + f.get(5L, TimeUnit.SECONDS); + shouldThrow(); + } catch (ExecutionException success) { + } catch (Exception ex) { + unexpectedException(ex); } - }; + }}; mainPool.invoke(a); } @@ -345,16 +331,15 @@ public class RecursiveActionTest extends */ public void testAbnormalForkHelpJoin() { RecursiveAction a = new RecursiveAction() { - public void compute() { - try { - FailingFibAction f = new FailingFibAction(8); - f.fork(); - f.helpJoin(); - shouldThrow(); - } catch (FJException success) { - } + public void compute() { + try { + FailingFibAction f = new FailingFibAction(8); + f.fork(); + f.helpJoin(); + shouldThrow(); + } catch (FJException success) { } - }; + }}; mainPool.invoke(a); } @@ -366,16 +351,15 @@ public class RecursiveActionTest extends */ public void testAbnormalForkQuietlyHelpJoin() { RecursiveAction a = new RecursiveAction() { - public void compute() { - FailingFibAction f = new FailingFibAction(8); - f.fork(); - f.quietlyHelpJoin(); - threadAssertTrue(f.isDone()); - threadAssertTrue(f.isCompletedAbnormally()); - threadAssertFalse(f.isCancelled()); - threadAssertTrue(f.getException() instanceof FJException); - } - }; + public void compute() { + FailingFibAction f = new FailingFibAction(8); + f.fork(); + f.quietlyHelpJoin(); + threadAssertTrue(f.isDone()); + threadAssertTrue(f.isCompletedAbnormally()); + threadAssertFalse(f.isCancelled()); + threadAssertTrue(f.getException() instanceof FJException); + }}; mainPool.invoke(a); } @@ -384,15 +368,14 @@ public class RecursiveActionTest extends */ public void testAbnormalForkQuietlyJoin() { RecursiveAction a = new RecursiveAction() { - public void compute() { - FailingFibAction f = new FailingFibAction(8); - f.fork(); - f.quietlyJoin(); - threadAssertTrue(f.isDone()); - threadAssertTrue(f.isCompletedAbnormally()); - threadAssertTrue(f.getException() instanceof FJException); - } - }; + public void compute() { + FailingFibAction f = new FailingFibAction(8); + f.fork(); + f.quietlyJoin(); + threadAssertTrue(f.isDone()); + threadAssertTrue(f.isCompletedAbnormally()); + threadAssertTrue(f.getException() instanceof FJException); + }}; mainPool.invoke(a); } @@ -401,16 +384,15 @@ public class RecursiveActionTest extends */ public void testCancelledInvoke() { RecursiveAction a = new RecursiveAction() { - public void compute() { - try { - FibAction f = new FibAction(8); - f.cancel(true); - f.invoke(); - shouldThrow(); - } catch (CancellationException success) { - } + public void compute() { + try { + FibAction f = new FibAction(8); + f.cancel(true); + f.invoke(); + shouldThrow(); + } catch (CancellationException success) { } - }; + }}; mainPool.invoke(a); } @@ -419,17 +401,16 @@ public class RecursiveActionTest extends */ public void testCancelledForkJoin() { RecursiveAction a = new RecursiveAction() { - public void compute() { - try { - FibAction f = new FibAction(8); - f.cancel(true); - f.fork(); - f.join(); - shouldThrow(); - } catch (CancellationException success) { - } + public void compute() { + try { + FibAction f = new FibAction(8); + f.cancel(true); + f.fork(); + f.join(); + shouldThrow(); + } catch (CancellationException success) { } - }; + }}; mainPool.invoke(a); } @@ -438,19 +419,18 @@ public class RecursiveActionTest extends */ public void testCancelledForkGet() { RecursiveAction a = new RecursiveAction() { - public void compute() { - try { - FibAction f = new FibAction(8); - f.cancel(true); - f.fork(); - f.get(); - shouldThrow(); - } catch (CancellationException success) { - } catch (Exception ex) { - unexpectedException(ex); - } + public void compute() { + try { + FibAction f = new FibAction(8); + f.cancel(true); + f.fork(); + f.get(); + shouldThrow(); + } catch (CancellationException success) { + } catch (Exception ex) { + unexpectedException(ex); } - }; + }}; mainPool.invoke(a); } @@ -459,19 +439,18 @@ public class RecursiveActionTest extends */ public void testCancelledForkTimedGet() { RecursiveAction a = new RecursiveAction() { - public void compute() { - try { - FibAction f = new FibAction(8); - f.cancel(true); - f.fork(); - f.get(5L, TimeUnit.SECONDS); - shouldThrow(); - } catch (CancellationException success) { - } catch (Exception ex) { - unexpectedException(ex); - } + public void compute() { + try { + FibAction f = new FibAction(8); + f.cancel(true); + f.fork(); + f.get(5L, TimeUnit.SECONDS); + shouldThrow(); + } catch (CancellationException success) { + } catch (Exception ex) { + unexpectedException(ex); } - }; + }}; mainPool.invoke(a); } @@ -480,17 +459,16 @@ public class RecursiveActionTest extends */ public void testCancelledForkHelpJoin() { RecursiveAction a = new RecursiveAction() { - public void compute() { - try { - FibAction f = new FibAction(8); - f.cancel(true); - f.fork(); - f.helpJoin(); - shouldThrow(); - } catch (CancellationException success) { - } + public void compute() { + try { + FibAction f = new FibAction(8); + f.cancel(true); + f.fork(); + f.helpJoin(); + shouldThrow(); + } catch (CancellationException success) { } - }; + }}; mainPool.invoke(a); } @@ -502,17 +480,16 @@ public class RecursiveActionTest extends */ public void testCancelledForkQuietlyHelpJoin() { RecursiveAction a = new RecursiveAction() { - public void compute() { - FibAction f = new FibAction(8); - f.cancel(true); - f.fork(); - f.quietlyHelpJoin(); - threadAssertTrue(f.isDone()); - threadAssertTrue(f.isCompletedAbnormally()); - threadAssertTrue(f.isCancelled()); - threadAssertTrue(f.getException() instanceof CancellationException); - } - }; + public void compute() { + FibAction f = new FibAction(8); + f.cancel(true); + f.fork(); + f.quietlyHelpJoin(); + threadAssertTrue(f.isDone()); + threadAssertTrue(f.isCompletedAbnormally()); + threadAssertTrue(f.isCancelled()); + threadAssertTrue(f.getException() instanceof CancellationException); + }}; mainPool.invoke(a); } @@ -521,16 +498,15 @@ public class RecursiveActionTest extends */ public void testCancelledForkQuietlyJoin() { RecursiveAction a = new RecursiveAction() { - public void compute() { - FibAction f = new FibAction(8); - f.cancel(true); - f.fork(); - f.quietlyJoin(); - threadAssertTrue(f.isDone()); - threadAssertTrue(f.isCompletedAbnormally()); - threadAssertTrue(f.getException() instanceof CancellationException); - } - }; + public void compute() { + FibAction f = new FibAction(8); + f.cancel(true); + f.fork(); + f.quietlyJoin(); + threadAssertTrue(f.isDone()); + threadAssertTrue(f.isCompletedAbnormally()); + threadAssertTrue(f.getException() instanceof CancellationException); + }}; mainPool.invoke(a); } @@ -539,10 +515,9 @@ public class RecursiveActionTest extends */ public void testGetPool() { RecursiveAction a = new RecursiveAction() { - public void compute() { - threadAssertTrue(getPool() == mainPool); - } - }; + public void compute() { + threadAssertTrue(getPool() == mainPool); + }}; mainPool.invoke(a); } @@ -551,10 +526,9 @@ public class RecursiveActionTest extends */ public void testGetPool2() { RecursiveAction a = new RecursiveAction() { - public void compute() { - threadAssertTrue(getPool() == null); - } - }; + public void compute() { + threadAssertTrue(getPool() == null); + }}; a.invoke(); } @@ -563,10 +537,9 @@ public class RecursiveActionTest extends */ public void testInForkJoinPool() { RecursiveAction a = new RecursiveAction() { - public void compute() { - threadAssertTrue(inForkJoinPool()); - } - }; + public void compute() { + threadAssertTrue(inForkJoinPool()); + }}; mainPool.invoke(a); } @@ -575,10 +548,9 @@ public class RecursiveActionTest extends */ public void testInForkJoinPool2() { RecursiveAction a = new RecursiveAction() { - public void compute() { - threadAssertTrue(!inForkJoinPool()); - } - }; + public void compute() { + threadAssertTrue(!inForkJoinPool()); + }}; a.invoke(); } @@ -587,12 +559,11 @@ public class RecursiveActionTest extends */ public void testWorkerGetPool() { RecursiveAction a = new RecursiveAction() { - public void compute() { - ForkJoinWorkerThread w = - (ForkJoinWorkerThread)(Thread.currentThread()); - threadAssertTrue(w.getPool() == mainPool); - } - }; + public void compute() { + ForkJoinWorkerThread w = + (ForkJoinWorkerThread)(Thread.currentThread()); + threadAssertTrue(w.getPool() == mainPool); + }}; mainPool.invoke(a); } @@ -602,14 +573,13 @@ public class RecursiveActionTest extends */ public void testWorkerGetPoolIndex() { RecursiveAction a = new RecursiveAction() { - public void compute() { - ForkJoinWorkerThread w = - (ForkJoinWorkerThread)(Thread.currentThread()); - int idx = w.getPoolIndex(); - threadAssertTrue(idx >= 0); - threadAssertTrue(idx < mainPool.getPoolSize()); - } - }; + public void compute() { + ForkJoinWorkerThread w = + (ForkJoinWorkerThread)(Thread.currentThread()); + int idx = w.getPoolIndex(); + threadAssertTrue(idx >= 0); + threadAssertTrue(idx < mainPool.getPoolSize()); + }}; mainPool.invoke(a); } @@ -619,10 +589,9 @@ public class RecursiveActionTest extends */ public void testSetRawResult() { RecursiveAction a = new RecursiveAction() { - public void compute() { - setRawResult(null); - } - }; + public void compute() { + setRawResult(null); + }}; a.invoke(); } @@ -631,18 +600,17 @@ public class RecursiveActionTest extends */ public void testReinitialize() { RecursiveAction a = new RecursiveAction() { - public void compute() { - FibAction f = new FibAction(8); - f.invoke(); - threadAssertTrue(f.result == 21); - threadAssertTrue(f.isDone()); - threadAssertFalse(f.isCancelled()); - threadAssertFalse(f.isCompletedAbnormally()); - f.reinitialize(); - f.invoke(); - threadAssertTrue(f.result == 21); - } - }; + public void compute() { + FibAction f = new FibAction(8); + f.invoke(); + threadAssertTrue(f.result == 21); + threadAssertTrue(f.isDone()); + threadAssertFalse(f.isCancelled()); + threadAssertFalse(f.isCompletedAbnormally()); + f.reinitialize(); + f.invoke(); + threadAssertTrue(f.result == 21); + }}; mainPool.invoke(a); } @@ -651,16 +619,15 @@ public class RecursiveActionTest extends */ public void testCompleteExceptionally() { RecursiveAction a = new RecursiveAction() { - public void compute() { - try { - FibAction f = new FibAction(8); - f.completeExceptionally(new FJException()); - f.invoke(); - shouldThrow(); - } catch (FJException success) { - } + public void compute() { + try { + FibAction f = new FibAction(8); + f.completeExceptionally(new FJException()); + f.invoke(); + shouldThrow(); + } catch (FJException success) { } - }; + }}; mainPool.invoke(a); } @@ -669,14 +636,13 @@ public class RecursiveActionTest extends */ public void testComplete() { RecursiveAction a = new RecursiveAction() { - public void compute() { - FibAction f = new FibAction(8); - f.complete(null); - f.invoke(); - threadAssertTrue(f.isDone()); - threadAssertTrue(f.result == 0); - } - }; + public void compute() { + FibAction f = new FibAction(8); + f.complete(null); + f.invoke(); + threadAssertTrue(f.isDone()); + threadAssertTrue(f.result == 0); + }}; mainPool.invoke(a); } @@ -685,16 +651,15 @@ public class RecursiveActionTest extends */ public void testInvokeAll2() { RecursiveAction a = new RecursiveAction() { - public void compute() { - FibAction f = new FibAction(8); - FibAction g = new FibAction(9); - invokeAll(f, g); - threadAssertTrue(f.isDone()); - threadAssertTrue(f.result == 21); - threadAssertTrue(g.isDone()); - threadAssertTrue(g.result == 34); - } - }; + public void compute() { + FibAction f = new FibAction(8); + FibAction g = new FibAction(9); + invokeAll(f, g); + threadAssertTrue(f.isDone()); + threadAssertTrue(f.result == 21); + threadAssertTrue(g.isDone()); + threadAssertTrue(g.result == 34); + }}; mainPool.invoke(a); } @@ -703,13 +668,12 @@ public class RecursiveActionTest extends */ public void testInvokeAll1() { RecursiveAction a = new RecursiveAction() { - public void compute() { - FibAction f = new FibAction(8); - invokeAll(f); - threadAssertTrue(f.isDone()); - threadAssertTrue(f.result == 21); - } - }; + public void compute() { + FibAction f = new FibAction(8); + invokeAll(f); + threadAssertTrue(f.isDone()); + threadAssertTrue(f.result == 21); + }}; mainPool.invoke(a); } @@ -718,19 +682,18 @@ public class RecursiveActionTest extends */ public void testInvokeAll3() { RecursiveAction a = new RecursiveAction() { - public void compute() { - FibAction f = new FibAction(8); - FibAction g = new FibAction(9); - FibAction h = new FibAction(7); - invokeAll(f, g, h); - threadAssertTrue(f.isDone()); - threadAssertTrue(f.result == 21); - threadAssertTrue(g.isDone()); - threadAssertTrue(g.result == 34); - threadAssertTrue(h.isDone()); - threadAssertTrue(h.result == 13); - } - }; + public void compute() { + FibAction f = new FibAction(8); + FibAction g = new FibAction(9); + FibAction h = new FibAction(7); + invokeAll(f, g, h); + threadAssertTrue(f.isDone()); + threadAssertTrue(f.result == 21); + threadAssertTrue(g.isDone()); + threadAssertTrue(g.result == 34); + threadAssertTrue(h.isDone()); + threadAssertTrue(h.result == 13); + }}; mainPool.invoke(a); } @@ -739,23 +702,22 @@ public class RecursiveActionTest extends */ public void testInvokeAllCollection() { RecursiveAction a = new RecursiveAction() { - public void compute() { - FibAction f = new FibAction(8); - FibAction g = new FibAction(9); - FibAction h = new FibAction(7); - HashSet set = new HashSet(); - set.add(f); - set.add(g); - set.add(h); - invokeAll(set); - threadAssertTrue(f.isDone()); - threadAssertTrue(f.result == 21); - threadAssertTrue(g.isDone()); - threadAssertTrue(g.result == 34); - threadAssertTrue(h.isDone()); - threadAssertTrue(h.result == 13); - } - }; + public void compute() { + FibAction f = new FibAction(8); + FibAction g = new FibAction(9); + FibAction h = new FibAction(7); + HashSet set = new HashSet(); + set.add(f); + set.add(g); + set.add(h); + invokeAll(set); + threadAssertTrue(f.isDone()); + threadAssertTrue(f.result == 21); + threadAssertTrue(g.isDone()); + threadAssertTrue(g.result == 34); + threadAssertTrue(h.isDone()); + threadAssertTrue(h.result == 13); + }}; mainPool.invoke(a); } @@ -765,17 +727,16 @@ public class RecursiveActionTest extends */ public void testInvokeAllNPE() { RecursiveAction a = new RecursiveAction() { - public void compute() { - try { - FibAction f = new FibAction(8); - FibAction g = new FibAction(9); - FibAction h = null; - invokeAll(f, g, h); - shouldThrow(); - } catch (NullPointerException success) { - } + public void compute() { + try { + FibAction f = new FibAction(8); + FibAction g = new FibAction(9); + FibAction h = null; + invokeAll(f, g, h); + shouldThrow(); + } catch (NullPointerException success) { } - }; + }}; mainPool.invoke(a); } @@ -784,16 +745,15 @@ public class RecursiveActionTest extends */ public void testAbnormalInvokeAll2() { RecursiveAction a = new RecursiveAction() { - public void compute() { - try { - FibAction f = new FibAction(8); - FailingFibAction g = new FailingFibAction(9); - invokeAll(f, g); - shouldThrow(); - } catch (FJException success) { - } + public void compute() { + try { + FibAction f = new FibAction(8); + FailingFibAction g = new FailingFibAction(9); + invokeAll(f, g); + shouldThrow(); + } catch (FJException success) { } - }; + }}; mainPool.invoke(a); } @@ -802,15 +762,14 @@ public class RecursiveActionTest extends */ public void testAbnormalInvokeAll1() { RecursiveAction a = new RecursiveAction() { - public void compute() { - try { - FailingFibAction g = new FailingFibAction(9); - invokeAll(g); - shouldThrow(); - } catch (FJException success) { - } + public void compute() { + try { + FailingFibAction g = new FailingFibAction(9); + invokeAll(g); + shouldThrow(); + } catch (FJException success) { } - }; + }}; mainPool.invoke(a); } @@ -819,17 +778,16 @@ public class RecursiveActionTest extends */ public void testAbnormalInvokeAll3() { RecursiveAction a = new RecursiveAction() { - public void compute() { - try { - FibAction f = new FibAction(8); - FailingFibAction g = new FailingFibAction(9); - FibAction h = new FibAction(7); - invokeAll(f, g, h); - shouldThrow(); - } catch (FJException success) { - } + public void compute() { + try { + FibAction f = new FibAction(8); + FailingFibAction g = new FailingFibAction(9); + FibAction h = new FibAction(7); + invokeAll(f, g, h); + shouldThrow(); + } catch (FJException success) { } - }; + }}; mainPool.invoke(a); } @@ -838,21 +796,20 @@ public class RecursiveActionTest extends */ public void testAbnormalInvokeAllCollection() { RecursiveAction a = new RecursiveAction() { - public void compute() { - try { - FailingFibAction f = new FailingFibAction(8); - FibAction g = new FibAction(9); - FibAction h = new FibAction(7); - HashSet set = new HashSet(); - set.add(f); - set.add(g); - set.add(h); - invokeAll(set); - shouldThrow(); - } catch (FJException success) { - } + public void compute() { + try { + FailingFibAction f = new FailingFibAction(8); + FibAction g = new FibAction(9); + FibAction h = new FibAction(7); + HashSet set = new HashSet(); + set.add(f); + set.add(g); + set.add(h); + invokeAll(set); + shouldThrow(); + } catch (FJException success) { } - }; + }}; mainPool.invoke(a); } @@ -862,17 +819,16 @@ public class RecursiveActionTest extends */ public void testTryUnfork() { RecursiveAction a = new RecursiveAction() { - public void compute() { - FibAction g = new FibAction(9); - g.fork(); - FibAction f = new FibAction(8); - f.fork(); - threadAssertTrue(f.tryUnfork()); - helpQuiesce(); - threadAssertFalse(f.isDone()); - threadAssertTrue(g.isDone()); - } - }; + public void compute() { + FibAction g = new FibAction(9); + g.fork(); + FibAction f = new FibAction(8); + f.fork(); + threadAssertTrue(f.tryUnfork()); + helpQuiesce(); + threadAssertFalse(f.isDone()); + threadAssertTrue(g.isDone()); + }}; singletonPool.invoke(a); } @@ -882,17 +838,16 @@ public class RecursiveActionTest extends */ public void testGetSurplusQueuedTaskCount() { RecursiveAction a = new RecursiveAction() { - public void compute() { - FibAction h = new FibAction(7); - h.fork(); - FibAction g = new FibAction(9); - g.fork(); - FibAction f = new FibAction(8); - f.fork(); - threadAssertTrue(getSurplusQueuedTaskCount() > 0); - helpQuiesce(); - } - }; + public void compute() { + FibAction h = new FibAction(7); + h.fork(); + FibAction g = new FibAction(9); + g.fork(); + FibAction f = new FibAction(8); + f.fork(); + threadAssertTrue(getSurplusQueuedTaskCount() > 0); + helpQuiesce(); + }}; singletonPool.invoke(a); } @@ -901,17 +856,16 @@ public class RecursiveActionTest extends */ public void testPeekNextLocalTask() { RecursiveAction a = new RecursiveAction() { - public void compute() { - FibAction g = new FibAction(9); - g.fork(); - FibAction f = new FibAction(8); - f.fork(); - threadAssertTrue(peekNextLocalTask() == f); - f.join(); - threadAssertTrue(f.isDone()); - helpQuiesce(); - } - }; + public void compute() { + FibAction g = new FibAction(9); + g.fork(); + FibAction f = new FibAction(8); + f.fork(); + threadAssertTrue(peekNextLocalTask() == f); + f.join(); + threadAssertTrue(f.isDone()); + helpQuiesce(); + }}; singletonPool.invoke(a); } @@ -921,16 +875,15 @@ public class RecursiveActionTest extends */ public void testPollNextLocalTask() { RecursiveAction a = new RecursiveAction() { - public void compute() { - FibAction g = new FibAction(9); - g.fork(); - FibAction f = new FibAction(8); - f.fork(); - threadAssertTrue(pollNextLocalTask() == f); - helpQuiesce(); - threadAssertFalse(f.isDone()); - } - }; + public void compute() { + FibAction g = new FibAction(9); + g.fork(); + FibAction f = new FibAction(8); + f.fork(); + threadAssertTrue(pollNextLocalTask() == f); + helpQuiesce(); + threadAssertFalse(f.isDone()); + }}; singletonPool.invoke(a); } @@ -940,17 +893,16 @@ public class RecursiveActionTest extends */ public void testPollTask() { RecursiveAction a = new RecursiveAction() { - public void compute() { - FibAction g = new FibAction(9); - g.fork(); - FibAction f = new FibAction(8); - f.fork(); - threadAssertTrue(pollTask() == f); - helpQuiesce(); - threadAssertFalse(f.isDone()); - threadAssertTrue(g.isDone()); - } - }; + public void compute() { + FibAction g = new FibAction(9); + g.fork(); + FibAction f = new FibAction(8); + f.fork(); + threadAssertTrue(pollTask() == f); + helpQuiesce(); + threadAssertFalse(f.isDone()); + threadAssertTrue(g.isDone()); + }}; singletonPool.invoke(a); } @@ -959,17 +911,16 @@ public class RecursiveActionTest extends */ public void testPeekNextLocalTaskAsync() { RecursiveAction a = new RecursiveAction() { - public void compute() { - FibAction g = new FibAction(9); - g.fork(); - FibAction f = new FibAction(8); - f.fork(); - threadAssertTrue(peekNextLocalTask() == g); - f.join(); - helpQuiesce(); - threadAssertTrue(f.isDone()); - } - }; + public void compute() { + FibAction g = new FibAction(9); + g.fork(); + FibAction f = new FibAction(8); + f.fork(); + threadAssertTrue(peekNextLocalTask() == g); + f.join(); + helpQuiesce(); + threadAssertTrue(f.isDone()); + }}; asyncSingletonPool.invoke(a); } @@ -979,17 +930,16 @@ public class RecursiveActionTest extends */ public void testPollNextLocalTaskAsync() { RecursiveAction a = new RecursiveAction() { - public void compute() { - FibAction g = new FibAction(9); - g.fork(); - FibAction f = new FibAction(8); - f.fork(); - threadAssertTrue(pollNextLocalTask() == g); - helpQuiesce(); - threadAssertTrue(f.isDone()); - threadAssertFalse(g.isDone()); - } - }; + public void compute() { + FibAction g = new FibAction(9); + g.fork(); + FibAction f = new FibAction(8); + f.fork(); + threadAssertTrue(pollNextLocalTask() == g); + helpQuiesce(); + threadAssertTrue(f.isDone()); + threadAssertFalse(g.isDone()); + }}; asyncSingletonPool.invoke(a); } @@ -999,17 +949,16 @@ public class RecursiveActionTest extends */ public void testPollTaskAsync() { RecursiveAction a = new RecursiveAction() { - public void compute() { - FibAction g = new FibAction(9); - g.fork(); - FibAction f = new FibAction(8); - f.fork(); - threadAssertTrue(pollTask() == g); - helpQuiesce(); - threadAssertTrue(f.isDone()); - threadAssertFalse(g.isDone()); - } - }; + public void compute() { + FibAction g = new FibAction(9); + g.fork(); + FibAction f = new FibAction(8); + f.fork(); + threadAssertTrue(pollTask() == g); + helpQuiesce(); + threadAssertTrue(f.isDone()); + threadAssertFalse(g.isDone()); + }}; asyncSingletonPool.invoke(a); }