-
Enhancement
-
Resolution: Duplicate
-
P3
-
None
-
None
-
None
ForkJoinTask.adaptInterruptible is a new method deferred from CSR
https://bugs.openjdk.java.net/browse/JDK-8246587
/**
* 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)
* <p>By default, method {@link #cancel} ignores its {@code
* mayInterruptIfRunning} argument, separating task cancellation from
* the interruption status of threads running tasks. However, the
* method is overridable to accommodate cases in which running tasks
* must be cancelled using interrupts. This may arise when adapting
* Callables that cannot check {@code isCancelled()} task status.
* Tasks constructed with the {@link #adaptInterruptible} adaptor
* track and interrupt the running thread upon {@code
* cancel(true)}. Reliable usage requires awareness of potential
* consequences: Method bodies should ignore stray interrupts to cope
* with the inherent possibility that a late interrupt issued by
* another thread after a given task has completed may (inadvertently)
* interrupt some future task. Further, interruptible tasks should not
* in general create subtasks, because an interrupt intended for a
* given task may be consumed by one of its subtasks, or vice versa.
https://bugs.openjdk.java.net/browse/JDK-8246587
/**
* 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)
* <p>By default, method {@link #cancel} ignores its {@code
* mayInterruptIfRunning} argument, separating task cancellation from
* the interruption status of threads running tasks. However, the
* method is overridable to accommodate cases in which running tasks
* must be cancelled using interrupts. This may arise when adapting
* Callables that cannot check {@code isCancelled()} task status.
* Tasks constructed with the {@link #adaptInterruptible} adaptor
* track and interrupt the running thread upon {@code
* cancel(true)}. Reliable usage requires awareness of potential
* consequences: Method bodies should ignore stray interrupts to cope
* with the inherent possibility that a late interrupt issued by
* another thread after a given task has completed may (inadvertently)
* interrupt some future task. Further, interruptible tasks should not
* in general create subtasks, because an interrupt intended for a
* given task may be consumed by one of its subtasks, or vice versa.
- duplicates
-
JDK-8277090 jsr166 refresh for jdk19
- Resolved