On Sat, 7 May 2022 11:29:32 GMT, Doug Lea <d...@openjdk.org> wrote: >> Changes ForkJoinPool.close spec and code to trap close as a no-op if called >> on common pool > > Doug Lea has updated the pull request incrementally with three additional > commits since the last revision: > > - Accommodate restrictive SecurityManagers > - merge with loom updates > Merge remote-tracking branch 'refs/remotes/origin/JDK-8286294' into > JDK-8286294 > - Fix testLazySubmit; enable suite
Here's a suggested strengthening of testCloseCommonPool: - close should have "no effect", not just "not terminate". - the submitted task will be run by the pool ... eventually (which suggests that closing the common pool maybe should quiesce the pool before returning) - I might merge this with testCommonPoolShutDown /** * Implicitly closing common pool using try-with-resources has no effect. */ public void testCloseCommonPool() { ForkJoinTask f = new FibAction(8); ForkJoinPool pool; try (ForkJoinPool p = pool = ForkJoinPool.commonPool()) { p.execute(f); } assertFalse(pool.isShutdown()); assertFalse(pool.isTerminating()); assertFalse(pool.isTerminated()); String prop = System.getProperty( "java.util.concurrent.ForkJoinPool.common.parallelism"); if (! "0".equals(prop)) { f.join(); checkCompletedNormally(f); } } ------------- PR: https://git.openjdk.java.net/jdk/pull/8577