{"id":992,"date":"2026-11-27T03:40:47","date_gmt":"2026-11-27T03:40:47","guid":{"rendered":"https:\/\/blockoala.com\/index.php\/2026\/11\/27\/jdk-28-finalizes-structured-concurrency-without-changing-the-jdk-27-api\/"},"modified":"2026-11-27T03:40:47","modified_gmt":"2026-11-27T03:40:47","slug":"jdk-28-finalizes-structured-concurrency-without-changing-the-jdk-27-api","status":"publish","type":"post","link":"https:\/\/blockoala.com\/index.php\/2026\/11\/27\/jdk-28-finalizes-structured-concurrency-without-changing-the-jdk-27-api\/","title":{"rendered":"JDK 28 finalizes structured concurrency without changing the JDK 27 API"},"content":{"rendered":"<p>As of November 27, 2026, JEP 543 had been integrated into JDK 28, making <code>java.util.concurrent.StructuredTaskScope<\/code> a permanent API after seven preview rounds. The finalization removed preview annotations but changed no method signatures. Teams using the JDK 27 preview can recompile their structured concurrency code unchanged on a JDK 28 early-access build that includes JEP 543. General availability was scheduled for March 2027.<\/p>\n<h2>What a task scope guarantees<\/h2>\n<p><code>StructuredTaskScope<\/code> treats related tasks running on separate threads as one unit of work. Consider a request handler that needs both a user record and an order. With <code>ExecutorService<\/code> and <code>Future<\/code>, the handler can return while a task is still running, and a failure may not surface until the handler calls <code>Future.get()<\/code> on that task.<\/p>\n<p>With the default <code>StructuredTaskScope.open()<\/code> policy, the handler calls <code>fork()<\/code> for each lookup, starting a virtual thread for each by default. A single <code>join()<\/code> waits for both lookups to succeed. If either fails, the scope cancels the remaining work and <code>join()<\/code> throws <code>ExecutionException<\/code>. Closing the scope at the end of a try-with-resources block cancels any unfinished tasks and waits for their threads to terminate before the handler leaves the block.<\/p>\n<p>Only the thread that opened the scope can call <code>fork()<\/code> or <code>join()<\/code>, and it can read results through <code>Subtask.get()<\/code> only after <code>join()<\/code> returns. Subtasks inherit <code>ScopedValue<\/code> bindings and appear beneath their parent thread in JSON thread dumps.<\/p>\n<p>One detail is deliberately unspecified: if several subtasks fail concurrently, callers cannot rely on which failure <code>join()<\/code> reports. After Viktor Klang raised the question during code review, Oracle&#8217;s JEP owner Alan Bateman revised the Javadoc to guarantee only that the reported exception comes from a failed subtask.<\/p>\n<h2>What changes for developers<\/h2>\n<p>For teams moving from <strong>JDK 27<\/strong>, the change is in the build rather than the code. Structured concurrency no longer requires <code>--enable-preview<\/code> in compiler commands, test runners or launch scripts. Library and framework maintainers can use the permanent API without requiring their users to enable preview features for it.<\/p>\n<p>Teams moving from <strong>JDK 26<\/strong> also need to account for changes made in the seventh preview. The built-in throwing joiners use <code>ExecutionException<\/code> rather than the preview-only <code>FailedException<\/code>. Custom <code>Joiner<\/code> implementations take a third type parameter, <code>R_X<\/code>, that specifies the exception <code>join()<\/code> can throw directly. For example, a joiner that needs two successful replica reads can cancel the rest once it has two results, or throw an application-defined checked exception if it falls short.<\/p>\n<p>JDK 26 users also need to revisit timeout handling. <code>StructuredTaskScope.TimeoutException<\/code> was removed; a timeout is now identified by a <code>CancelledByTimeoutException<\/code> cause. The abstract <code>timeout()<\/code> method replaced the <code>onTimeout()<\/code> callback, and <code>Joiner.awaitAll()<\/code> is no longer available.<\/p>\n<p>Structured concurrency first appeared as an incubating API in JDK 19 and 20, then went through a preview in every release from JDK 21 through JDK 27, the longest preview cycle of any Project Loom feature. For teams still on JDK 25, the <code>velo\/structured-concurrency<\/code> project has backported the JEP 543 API and provides a guide to switching to the native JDK classes after an upgrade.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As of November 27, 2026, JEP 543 had been integrated into JDK 28, making java.util.concurrent.StructuredTaskScope a permanent API [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-992","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blockoala.com\/index.php\/wp-json\/wp\/v2\/posts\/992","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blockoala.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blockoala.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blockoala.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blockoala.com\/index.php\/wp-json\/wp\/v2\/comments?post=992"}],"version-history":[{"count":0,"href":"https:\/\/blockoala.com\/index.php\/wp-json\/wp\/v2\/posts\/992\/revisions"}],"wp:attachment":[{"href":"https:\/\/blockoala.com\/index.php\/wp-json\/wp\/v2\/media?parent=992"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blockoala.com\/index.php\/wp-json\/wp\/v2\/categories?post=992"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blockoala.com\/index.php\/wp-json\/wp\/v2\/tags?post=992"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}