RRFR 8002356: Add ForkJoin common pool and CountedCompleted

Doug Lea dl at cs.oswego.edu
Mon Dec 17 16:12:04 UTC 2012

On 12/13/12 15:16, Mike Duigou wrote:
> Some notes:


> - The Object padding (pad10 - pad1d) in WorkQueue and ForkJoinPool is
> sensitive to reference size and compressed OOPS. I was surprised to see
> Object used rather than long or int.

Until we get @Contended, this is black art. Because of how layouts
work, you need trailing padding to be refs for anything with at
least one ref.

> - how is getCommonPoolParallelism() different from
> commonPool().getParallelism() ? Seems redundant.

The method exists because of static-init bootstrapping constraints,
and is public just because it is handy in other contexts as well;
for example, JDK or user code might want to adopt sizings commensurate
commonPoolParallelism. As a user of this myself (in ConcurrentHashMap
spliterators), I found that I wanted this method, so figured others
will too.

> - I would document the effects of shutdown, shutdownNow, awaitTermination,
> isTerminating specific to the common pool on getCommonPool() rather than on
> the individual methods. The discussion seems out of place on the individual
> methods. Everything about the common pool should be consolidated (or
> replicated) on getCommonPool() for one-stop-shopping to understand the
> characteristics of the common pool.

Notes about commonPool are also now top-level javadocs as well
as on per-method shutdown etc (where they must be). But given that
at least one reader expected them elsewhere, I'll revise:

      * Returns the common pool instance. This pool is statically
      * constructed; its run state is unaffected by attempts to
      * {@link @shutdown} or {@link #shutdownNow}.
      * @return the common pool instance
     public static ForkJoinPool commonPool() ...

> - ForkJoinTask - "If the current thread is operating in a ForkJoinPool," and
> similar phrases. It doesn't say what happens if it isn't.

I think that all wording along these lines  is now gone?

> - CountedCompleter : "Asuuming" -> "Assuming"

Thanks. Already fixed since Chris's last grab.


More information about the core-libs-dev mailing list