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

Comparing jsr166/src/test/tck/ForkJoinTaskTest.java (file contents):
Revision 1.29 by jsr166, Tue Nov 23 06:33:26 2010 UTC vs.
Revision 1.33 by jsr166, Fri May 27 19:42:42 2011 UTC

# Line 1 | Line 1
1   /*
2   * Written by Doug Lea with assistance from members of JCP JSR-166
3   * Expert Group and released to the public domain, as explained at
4 < * http://creativecommons.org/licenses/publicdomain
4 > * http://creativecommons.org/publicdomain/zero/1.0/
5   */
6   import java.util.concurrent.ExecutionException;
7   import java.util.concurrent.CancellationException;
# Line 162 | Line 162 | public class ForkJoinTaskTest extends JS
162          assertFalse(a.isCancelled());
163          assertFalse(a.isCompletedNormally());
164          assertTrue(a.isCompletedAbnormally());
165 <        assertSame(t, a.getException());
165 >        assertSame(t.getClass(), a.getException().getClass());
166          assertNull(a.getRawResult());
167          assertFalse(a.cancel(false));
168          assertFalse(a.cancel(true));
# Line 172 | Line 172 | public class ForkJoinTaskTest extends JS
172              a.join();
173              shouldThrow();
174          } catch (Throwable expected) {
175 <            assertSame(t, expected);
175 >            assertSame(t.getClass(), expected.getClass());
176          }
177          Thread.interrupted();
178  
# Line 186 | Line 186 | public class ForkJoinTaskTest extends JS
186              a.get();
187              shouldThrow();
188          } catch (ExecutionException success) {
189 <            assertSame(t, success.getCause());
189 >            assertSame(t.getClass(), success.getCause().getClass());
190          } catch (Throwable fail) { threadUnexpectedException(fail); }
191  
192          try {
193              a.get(5L, SECONDS);
194              shouldThrow();
195          } catch (ExecutionException success) {
196 <            assertSame(t, success.getCause());
196 >            assertSame(t.getClass(), success.getCause().getClass());
197          } catch (Throwable fail) { threadUnexpectedException(fail); }
198      }
199  
# Line 205 | Line 205 | public class ForkJoinTaskTest extends JS
205       * differently than supplied Recursive forms.
206       */
207  
208 <    static final class FJException extends RuntimeException {
208 >    public static final class FJException extends RuntimeException {
209          FJException() { super(); }
210      }
211  
# Line 349 | Line 349 | public class ForkJoinTaskTest extends JS
349          }
350      }
351  
352
352      static final class FailingAsyncFib extends BinaryAsyncAction {
353          int number;
354          public FailingAsyncFib(int n) {
# Line 486 | Line 485 | public class ForkJoinTaskTest extends JS
485          testInvokeOnPool(mainPool(), a);
486      }
487  
489
488      /**
489       * helpQuiesce returns when tasks are complete.
490       * getQueuedTaskCount returns 0 when quiescent
# Line 496 | Line 494 | public class ForkJoinTaskTest extends JS
494              public void realCompute() {
495                  AsyncFib f = new AsyncFib(8);
496                  assertSame(f, f.fork());
497 <                f.helpQuiesce();
497 >                helpQuiesce();
498                  assertEquals(21, f.number);
499                  assertEquals(0, getQueuedTaskCount());
500                  checkCompletedNormally(f);
# Line 504 | Line 502 | public class ForkJoinTaskTest extends JS
502          testInvokeOnPool(mainPool(), a);
503      }
504  
507
505      /**
506       * invoke task throws exception when task completes abnormally
507       */
# Line 849 | Line 846 | public class ForkJoinTaskTest extends JS
846          testInvokeOnPool(mainPool(), a);
847      }
848  
852
849      /**
850       * invokeAll(tasks) with any null task throws NPE
851       */
# Line 1213 | Line 1209 | public class ForkJoinTaskTest extends JS
1209          testInvokeOnPool(singletonPool(), a);
1210      }
1211  
1216
1212      /**
1213       * helpQuiesce returns when tasks are complete.
1214       * getQueuedTaskCount returns 0 when quiescent
# Line 1223 | Line 1218 | public class ForkJoinTaskTest extends JS
1218              public void realCompute() {
1219                  AsyncFib f = new AsyncFib(8);
1220                  assertSame(f, f.fork());
1221 <                f.helpQuiesce();
1221 >                helpQuiesce();
1222                  assertEquals(0, getQueuedTaskCount());
1223                  assertEquals(21, f.number);
1224                  checkCompletedNormally(f);
# Line 1231 | Line 1226 | public class ForkJoinTaskTest extends JS
1226          testInvokeOnPool(singletonPool(), a);
1227      }
1228  
1234
1229      /**
1230       * invoke task throws exception when task completes abnormally
1231       */
# Line 1519 | Line 1513 | public class ForkJoinTaskTest extends JS
1513          testInvokeOnPool(singletonPool(), a);
1514      }
1515  
1522
1516      /**
1517       * invokeAll(tasks) with any null task throws NPE
1518       */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines