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.2 by dl, Fri May 6 16:02:32 2022 UTC

# Line 465 | Line 465 | public class ForkJoinPool19Test extends
465          }
466      }
467  
468 +    /**
469 +     * Implictly closing a new pool using try-with-resources terminates it
470 +     */
471 +    public void testClose() {
472 +        ForkJoinTask f = new FibAction(8);
473 +        ForkJoinPool pool = null;
474 +        try (ForkJoinPool p = new ForkJoinPool()) {
475 +            pool = p;
476 +            p.execute(f);
477 +        }
478 +        checkCompletedNormally(f);
479 +        assertTrue(pool != null && pool.isTerminated());
480 +    }
481 +
482 +    /**
483 +     * Implictly closing commonpool using try-with-resources does not
484 +     * terminate it
485 +     */
486 +    public void testCloseCommonPool() {
487 +        ForkJoinTask f = new FibAction(8);
488 +        ForkJoinPool pool;
489 +        try (ForkJoinPool p = ForkJoinPool.commonPool()) {
490 +            pool = p;
491 +            p.execute(f);
492 +        }
493 +        assertFalse(pool.isTerminated());
494 +    }
495   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines