<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Java-24 on dplabs — Software Engineering &amp; Technology Consultancy</title>
		<link>https://dplabs.tech/tags/java-24/</link>
		<description>Recent content in Java-24 on dplabs — Software Engineering &amp; Technology Consultancy</description>
		<generator>Hugo</generator>
		<language>en-us</language>
		
		
		
		
			<lastBuildDate>Mon, 28 Apr 2025 00:00:00 +0000</lastBuildDate>
		
			<atom:link href="https://dplabs.tech/tags/java-24/index.xml" rel="self" type="application/rss+xml" />
			<item>
				<title>Structured Concurrency in Java: Fixing Unstructured Concurrent Code</title>
				<link>https://dplabs.tech/blog/structured-concurrency-java/</link>
				<pubDate>Mon, 28 Apr 2025 00:00:00 +0000</pubDate>
				<guid>https://dplabs.tech/blog/structured-concurrency-java/</guid>
				<description>&lt;p&gt;Java&amp;rsquo;s concurrency model has been functional for decades. &lt;code&gt;ExecutorService&lt;/code&gt;, &lt;code&gt;Future&lt;/code&gt;, &lt;code&gt;CompletableFuture&lt;/code&gt; — these tools work. They also have a persistent problem: when you submit tasks to an executor, the relationship between the spawning thread and the spawned tasks is not represented in the code. Errors are easy to lose. Cancellation doesn&amp;rsquo;t propagate automatically. Resources leak when tasks outlive their intended scope.&lt;/p&gt;&#xA;&lt;p&gt;Structured concurrency, finalized in Java 24 (JEP 505 after multiple preview rounds), fixes this. The core principle: &lt;strong&gt;concurrent tasks should have lifetimes that are scoped to the block of code that spawned them&lt;/strong&gt;, just as &lt;code&gt;try-with-resources&lt;/code&gt; scopes resource lifetimes.&lt;/p&gt;</description>
			</item>
	</channel>
</rss>
