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.23 by jsr166, Mon Nov 22 07:50:50 2010 UTC vs.
Revision 1.24 by jsr166, Mon Nov 22 20:19:47 2010 UTC

# Line 247 | Line 247 | public class RecursiveActionTest extends
247      }
248  
249      /**
250 +     * join/quietlyJoin of a forked task ignores interrupts
251 +     */
252 +    public void testJoinIgnoresInterrupts() {
253 +        RecursiveAction a = new CheckedRecursiveAction() {
254 +            public void realCompute() {
255 +                FibAction f = new FibAction(8);
256 +
257 +                // test join()
258 +                assertSame(f, f.fork());
259 +                Thread.currentThread().interrupt();
260 +                assertNull(f.join());
261 +                assertTrue(Thread.interrupted());
262 +                assertEquals(21, f.result);
263 +                checkCompletedNormally(f);
264 +
265 +                f.reinitialize();
266 +                f.cancel(true);
267 +                assertSame(f, f.fork());
268 +                Thread.currentThread().interrupt();
269 +                try {
270 +                    f.join();
271 +                    shouldThrow();
272 +                } catch (CancellationException success) {
273 +                    assertTrue(Thread.interrupted());
274 +                    checkCancelled(f);
275 +                }
276 +
277 +                f.reinitialize();
278 +                f.completeExceptionally(new FJException());
279 +                assertSame(f, f.fork());
280 +                Thread.currentThread().interrupt();
281 +                try {
282 +                    f.join();
283 +                    shouldThrow();
284 +                } catch (FJException success) {
285 +                    assertTrue(Thread.interrupted());
286 +                    checkCompletedAbnormally(f, success);
287 +                }
288 +
289 +                // test quietlyJoin()
290 +                f.reinitialize();
291 +                assertSame(f, f.fork());
292 +                Thread.currentThread().interrupt();
293 +                f.quietlyJoin();
294 +                assertTrue(Thread.interrupted());
295 +                assertEquals(21, f.result);
296 +                checkCompletedNormally(f);
297 +
298 +                f.reinitialize();
299 +                f.cancel(true);
300 +                assertSame(f, f.fork());
301 +                Thread.currentThread().interrupt();
302 +                f.quietlyJoin();
303 +                assertTrue(Thread.interrupted());
304 +                checkCancelled(f);
305 +
306 +                f.reinitialize();
307 +                f.completeExceptionally(new FJException());
308 +                assertSame(f, f.fork());
309 +                Thread.currentThread().interrupt();
310 +                f.quietlyJoin();
311 +                assertTrue(Thread.interrupted());
312 +                checkCompletedAbnormally(f, f.getException());
313 +            }};
314 +        testInvokeOnPool(mainPool(), a);
315 +        a.reinitialize();
316 +        testInvokeOnPool(singletonPool(), a);
317 +    }
318 +
319 +    /**
320       * get of a forked task returns when task completes
321       */
322      public void testForkGet() {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines