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

Comparing jsr166/src/test/tck/ForkJoinTask8Test.java (file contents):
Revision 1.1 by dl, Sun Jul 21 22:24:18 2013 UTC vs.
Revision 1.6 by jsr166, Wed Dec 31 17:00:58 2014 UTC

# Line 3 | Line 3
3   * Expert Group and released to the public domain, as explained at
4   * http://creativecommons.org/publicdomain/zero/1.0/
5   */
6 + import java.util.HashSet;
7   import java.util.concurrent.ExecutionException;
7 import java.util.concurrent.CancellationException;
8   import java.util.concurrent.ForkJoinPool;
9   import java.util.concurrent.ForkJoinTask;
10 import java.util.concurrent.ForkJoinWorkerThread;
10   import java.util.concurrent.RecursiveAction;
12 import java.util.concurrent.TimeUnit;
11   import java.util.concurrent.TimeoutException;
14 import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
12   import static java.util.concurrent.TimeUnit.MILLISECONDS;
13   import static java.util.concurrent.TimeUnit.SECONDS;
17 import java.util.HashSet;
14   import junit.framework.*;
15  
16   public class ForkJoinTask8Test extends JSR166TestCase {
# Line 32 | Line 28 | public class ForkJoinTask8Test extends J
28      static final short INITIAL_STATE = -1;
29      static final short COMPLETE_STATE = 0;
30      static final short EXCEPTION_STATE = 1;
35        
31  
32      public static void main(String[] args) {
33          junit.textui.TestRunner.run(suite());
# Line 206 | Line 201 | public class ForkJoinTask8Test extends J
201          }
202  
203          protected void onComplete(BinaryAsyncAction x, BinaryAsyncAction y) {
204 <            if (this.getForkJoinTaskTag() != COMPLETE_STATE ||
205 <                x.getForkJoinTaskTag() != COMPLETE_STATE ||
204 >            if (this.getForkJoinTaskTag() != COMPLETE_STATE ||
205 >                x.getForkJoinTaskTag() != COMPLETE_STATE ||
206                  y.getForkJoinTaskTag() != COMPLETE_STATE) {
207                  completeThisExceptionally(new FJException());
208              }
# Line 241 | Line 236 | public class ForkJoinTask8Test extends J
236                  a.sibling = null;
237                  a.parent = null;
238                  a.completeThis();
239 <                if (p == null ||
239 >                if (p == null ||
240                      p.compareAndSetForkJoinTaskTag(INITIAL_STATE, COMPLETE_STATE))
241                      break;
242                  try {
# Line 279 | Line 274 | public class ForkJoinTask8Test extends J
274              super.reinitialize();
275          }
276  
282
277      }
278  
279      static final class AsyncFib extends BinaryAsyncAction {
# Line 304 | Line 298 | public class ForkJoinTask8Test extends J
298                  }
299                  f.complete();
300              }
301 <            catch(Throwable ex) {
301 >            catch (Throwable ex) {
302                  compareAndSetForkJoinTaskTag(INITIAL_STATE, EXCEPTION_STATE);
303              }
304              return false;
# Line 573 | Line 567 | public class ForkJoinTask8Test extends J
567          testInvokeOnPool(mainPool(), a);
568      }
569  
576
570      /**
571       * getPool of executing task returns its pool
572       */
# Line 796 | Line 789 | public class ForkJoinTask8Test extends J
789      }
790  
791      /**
792 <     * invokeAll(collection)  throws exception if any task does
792 >     * invokeAll(collection) throws exception if any task does
793       */
794      public void testAbnormalInvokeAllCollection() {
795          RecursiveAction a = new CheckedRecursiveAction() {
# Line 1373 | Line 1366 | public class ForkJoinTask8Test extends J
1366      }
1367  
1368      /**
1369 <     * invokeAll(collection)  throws exception if any task does
1369 >     * invokeAll(collection) throws exception if any task does
1370       */
1371      public void testAbnormalInvokeAllCollectionSingleton() {
1372          RecursiveAction a = new CheckedRecursiveAction() {
# Line 1395 | Line 1388 | public class ForkJoinTask8Test extends J
1388          testInvokeOnPool(singletonPool(), a);
1389      }
1390  
1398
1391      /**
1392       * ForkJoinTask.quietlyComplete returns when task completes
1393       * normally without setting a value. The most recent value

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines