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

Comparing jsr166/src/test/tck/ForkJoinPool19Test.java (file contents):
Revision 1.1 by dl, Tue Mar 22 16:26:18 2022 UTC vs.
Revision 1.3 by jsr166, Fri Nov 25 16:39:48 2022 UTC

# Line 41 | Line 41 | public class ForkJoinPool19Test extends
41          assertEquals(3, p.setParallelism(2));
42          p.shutdown();
43      }
44 +
45      /**
46       * SetParallelism throws exception if argument out of bounds
47       */
# Line 60 | Line 61 | public class ForkJoinPool19Test extends
61          p.shutdown();
62      }
63  
64 <
64 >
65      /*
66       * Some test methods adapted from RecursiveAction
67       */
# Line 465 | Line 466 | public class ForkJoinPool19Test extends
466          }
467      }
468  
469 +    /**
470 +     * Implictly closing a new pool using try-with-resources terminates it
471 +     */
472 +    public void testClose() {
473 +        ForkJoinTask f = new FibAction(8);
474 +        ForkJoinPool pool = null;
475 +        try (ForkJoinPool p = new ForkJoinPool()) {
476 +            pool = p;
477 +            p.execute(f);
478 +        }
479 +        checkCompletedNormally(f);
480 +        assertTrue(pool != null && pool.isTerminated());
481 +    }
482 +
483 +    /**
484 +     * Implictly closing commonpool using try-with-resources does not
485 +     * terminate it
486 +     */
487 +    public void testCloseCommonPool() {
488 +        ForkJoinTask f = new FibAction(8);
489 +        ForkJoinPool pool;
490 +        try (ForkJoinPool p = ForkJoinPool.commonPool()) {
491 +            pool = p;
492 +            p.execute(f);
493 +        }
494 +        assertFalse(pool.isTerminated());
495 +    }
496   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines