--- jsr166/src/test/tck/ForkJoinTask8Test.java 2013/07/21 22:24:18 1.1 +++ jsr166/src/test/tck/ForkJoinTask8Test.java 2014/12/31 17:00:58 1.6 @@ -3,18 +3,14 @@ * Expert Group and released to the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ +import java.util.HashSet; import java.util.concurrent.ExecutionException; -import java.util.concurrent.CancellationException; import java.util.concurrent.ForkJoinPool; import java.util.concurrent.ForkJoinTask; -import java.util.concurrent.ForkJoinWorkerThread; import java.util.concurrent.RecursiveAction; -import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; -import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.SECONDS; -import java.util.HashSet; import junit.framework.*; public class ForkJoinTask8Test extends JSR166TestCase { @@ -32,7 +28,6 @@ public class ForkJoinTask8Test extends J static final short INITIAL_STATE = -1; static final short COMPLETE_STATE = 0; static final short EXCEPTION_STATE = 1; - public static void main(String[] args) { junit.textui.TestRunner.run(suite()); @@ -206,8 +201,8 @@ public class ForkJoinTask8Test extends J } protected void onComplete(BinaryAsyncAction x, BinaryAsyncAction y) { - if (this.getForkJoinTaskTag() != COMPLETE_STATE || - x.getForkJoinTaskTag() != COMPLETE_STATE || + if (this.getForkJoinTaskTag() != COMPLETE_STATE || + x.getForkJoinTaskTag() != COMPLETE_STATE || y.getForkJoinTaskTag() != COMPLETE_STATE) { completeThisExceptionally(new FJException()); } @@ -241,7 +236,7 @@ public class ForkJoinTask8Test extends J a.sibling = null; a.parent = null; a.completeThis(); - if (p == null || + if (p == null || p.compareAndSetForkJoinTaskTag(INITIAL_STATE, COMPLETE_STATE)) break; try { @@ -279,7 +274,6 @@ public class ForkJoinTask8Test extends J super.reinitialize(); } - } static final class AsyncFib extends BinaryAsyncAction { @@ -304,7 +298,7 @@ public class ForkJoinTask8Test extends J } f.complete(); } - catch(Throwable ex) { + catch (Throwable ex) { compareAndSetForkJoinTaskTag(INITIAL_STATE, EXCEPTION_STATE); } return false; @@ -573,7 +567,6 @@ public class ForkJoinTask8Test extends J testInvokeOnPool(mainPool(), a); } - /** * getPool of executing task returns its pool */ @@ -796,7 +789,7 @@ public class ForkJoinTask8Test extends J } /** - * invokeAll(collection) throws exception if any task does + * invokeAll(collection) throws exception if any task does */ public void testAbnormalInvokeAllCollection() { RecursiveAction a = new CheckedRecursiveAction() { @@ -1373,7 +1366,7 @@ public class ForkJoinTask8Test extends J } /** - * invokeAll(collection) throws exception if any task does + * invokeAll(collection) throws exception if any task does */ public void testAbnormalInvokeAllCollectionSingleton() { RecursiveAction a = new CheckedRecursiveAction() { @@ -1395,7 +1388,6 @@ public class ForkJoinTask8Test extends J testInvokeOnPool(singletonPool(), a); } - /** * ForkJoinTask.quietlyComplete returns when task completes * normally without setting a value. The most recent value