Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8362882

Update SubmissionPublisher() specification to reflect use of ForkJoinPool.asyncCommonPool()

XMLWordPrintable

        The implementation of SubmissionPublisher() was updated as part of JDK-8350493: Improve performance of delayed task handling. This change removed the use of a conditionally selected executor (ASYNC_POOL) and replaced it with a consistent use of ForkJoinPool.asyncCommonPool():

        public SubmissionPublisher() {
            this(ForkJoinPool.asyncCommonPool(), Flow.defaultBufferSize(), null);
        }

        Previously, the executor used was defined as:

        private static final Executor ASYNC_POOL =
            (ForkJoinPool.getCommonPoolParallelism() > 1)
            ? ForkJoinPool.commonPool() : new ThreadPerTaskExecutor();

        This change avoids the overhead of spawning a new thread for each task when ForkJoinPool.commonPool() has zero parallelism. It provides a more consistent and performant behavior for asynchronous task execution.

        However, the Javadoc specification of the SubmissionPublisher() constructor still describes behavior in terms of the previously conditional logic based on the parallelism level of the common pool.

        Request
        The Javadoc specification of the no-arg constructor SubmissionPublisher() still reflects the old behavior that depended on the common pool’s parallelism level. Since the implementation now always uses ForkJoinPool.asyncCommonPool(), the specification must be updated to:

        Reflect the consistent use of the asynchronous common pool.
        Remove any mention of conditional logic based on ForkJoinPool.getCommonPoolParallelism().

              alanb Alan Bateman
              kganapureddy Krushnareddy Ganapureddy
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: