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

Implementation of Structured Concurrency (Second Incubator)

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 20
    • core-libs
    • None
    • minimal
    • None
    • Java API
    • JDK

      Summary

      Structured Concurrency was proposed by JEP 428 and delivered in JDK 19 as an incubating API. JEP 437 proposes to re-incubate the API without changes, in JDK 20, to allow time for more feedback and to get more experience with this feature.

      The only change in the re-incubated API is that StructuredTaskScope is updated to support the inheritance of scoped values by threads created in a task scope. This streamlines the sharing of immutable data across threads. The API change (docs only) will be included in the CSR for JEP 429.

      Problem

      The goal of this feature is unchanged, that is the goal is to improve the maintainability, reliability, and observability of multithreaded code, in a style that eliminates common risks arising from cancellation and shutdown.

      Solution

      The APIs that are proposed to continue to incubate in module jdk.incubator.concurrent and package jdk.incubator.concurrent are:

      class StructuredTaskScope
      class StructuredTaskScope.ShutdownOnSuccess
      class StructuredTaskScope.ShutdownOnFailure
      exception StructureViolationException

      Specification

      There are no specification changes proposed.

      A future CSR will likely do some refinements, e.g. have the API docs set expectations when subclassing, or maybe change the return type from the fork method. We propose to wait for more feedback before making changes to the API.

            alanb Alan Bateman
            alanb Alan Bateman
            Ron Pressler
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: