Details

    • Type: CSR
    • Status: Draft
    • Priority: P3
    • Resolution: Unresolved
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Compatibility Kind:
      source
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      Negligible risk of a name-clash with user ForkJoinTask subclasses
    • Interface Kind:
      Java API
    • Scope:
      JDK

      Description

      Summary

      Add cancel-on-interrupt ForkJoinTask adaptor

      Problem

      Some potential FJ usages require that tasks are cancelled when their threads are interrupted, which is not the default policy for adapting Callables.

      Solution

      Introduce a method adaptInterruptible that supports this policy. An overview of the solution. Alternative solutions may be discussed;

      Specification

      /**
       * Returns a new {@code ForkJoinTask} that performs the {@code call}
       * method of the given {@code Callable} as its action, and returns
       * its result upon {@link #join}, translating any checked exceptions
       * encountered into {@code RuntimeException}.  Additionally,
       * invocations of {@code cancel} with {@code mayInterruptIfRunning
       * true} will attempt to interrupt the thread performing the task.
       *
       * @param callable the callable action
       * @param <T> the type of the callable's result
       * @return the task
       *
       * @since 15
       */
      public static <T> ForkJoinTask<T> adaptInterruptible(Callable<? extends T> callable)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dl Doug Lea
                Reporter:
                dl Doug Lea
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated: