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

Implementation of Structured Concurrency (Incubator)

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • 19
    • core-libs
    • None
    • minimal
    • New API in incubator module, no compatibility impact.
    • Java API
    • JDK

      This is the CSR for JEP 428: Structured Concurrency (Incubator).

      Summary

      Add a basic API for "Structured Concurrency". Structured concurrency treats multiple tasks running in different threads as a single unit of work, thereby streamlining error handling and cancellation, improving reliability, and enhancing observability.

      Problem

      The Motivation section in the JEP outlines common pitfalls that can arise when writing concurrent code. In particular, a method might spawn a thread to run a subtask, and then return, leaving the subtask running in the background, its lifetime unclear from the code. Alternatively a concurrent subtask might fail, leaving its failure unnoticed and ignored.

      Solution

      Add a simple API that introduces developers to the concepts of structured concurrency on the one hand, while looking familiar by resembling existing constructs, like ExecutorService on the other. The JEP provides discussion and examples of the proposed solution.

      The proposed API is in an incubator module, the module and package name proposed is jdk.incubator.concurrent.

      Specification

      The API docs are attached.

        1. sc-api-20220530.zip
          136 kB
        2. sc-api-20220521.zip
          134 kB
        3. sc-api-20220402.zip
          145 kB

            alanb Alan Bateman
            alanb Alan Bateman
            Paul Sandoz
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: