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

ForkJoinPool.commonPool().close() spins

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 19
    • core-libs
    • None
    • behavioral
    • minimal
    • None. this is a new API.
    • Java API
    • SE

      Summary

      The https://bugs.openjdk.java.net/browse/JDK-8285450 spec for ExecutorService.close should have been accompanied by an override for ForkJoinPool to cover the case of the commonPool, which never terminates. Now included.

      Problem

      Missing override.

      Solution

      Added override.

      Specification

      In class ForkJoinPool:

      /**
       * Unless this is the {@link #commonPool()}, initiates an orderly
       * shutdown in which previously submitted tasks are executed, but
       * no new tasks will be accepted, and waits until all tasks have
       * completed execution and the executor has terminated.
       *
       * <p> If already terminated, or this is the {@link
       * #commonPool()}, this method has no effect on execution, and
       * does not wait. Otherwise, if interrupted while waiting, this
       * method stops all executing tasks as if by invoking {@link
       * #shutdownNow()}. It then continues to wait until all actively
       * executing tasks have completed. Tasks that were awaiting
       * execution are not executed. The interrupt status will be
       * re-asserted before this method returns.
       *
       * @throws SecurityException if a security manager exists and
       *         shutting down this ExecutorService may manipulate
       *         threads that the caller is not permitted to modify
       *         because it does not hold {@link
       *         java.lang.RuntimePermission}{@code ("modifyThread")},
       *         or the security manager's {@code checkAccess} method
       *         denies access.
       * @since 19
       */
      @Override
      public void close()

            dl Doug Lea
            alanb Alan Bateman
            Alan Bateman, Joe Darcy, Martin Buchholz
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: