RFR: 8349462: Gatherers.mapConcurrent could support async interrupts

David Holmes dholmes at openjdk.org
Thu Feb 6 06:17:11 UTC 2025


On Wed, 5 Feb 2025 16:14:41 GMT, Viktor Klang <vklang at openjdk.org> wrote:

> This change is likely going to need some extra verbiage in the spec for mapConcurrent, and thus a CSR.
> This behavior aligns mapConcurrent with how parallel streams work in conjunction with interruptions of the caller thread.

src/java.base/share/classes/java/util/stream/Gatherers.java line 432:

> 430:                                 } catch (InterruptedException ie) {
> 431:                                     // We ignore interrupts here because we cannot proceed
> 432:                                     // until all spawned threads have exited

Why discard instead of keeping existing deferral? Swallowing interrupt requests generally breaks cancellation.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/23467#discussion_r1944157403


More information about the core-libs-dev mailing list