<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Virtual-Threads on dplabs — Software Engineering &amp; Technology Consultancy</title>
		<link>https://dplabs.tech/tags/virtual-threads/</link>
		<description>Recent content in Virtual-Threads 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/virtual-threads/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>
			<item>
				<title>Java 17 to 21: Modern Java Is a Different Language</title>
				<link>https://dplabs.tech/blog/java-17-to-21-modern-java/</link>
				<pubDate>Mon, 16 Dec 2024 00:00:00 +0000</pubDate>
				<guid>https://dplabs.tech/blog/java-17-to-21-modern-java/</guid>
				<description>&lt;p&gt;Java 21 is the current long-term support release as of late 2024, and it represents something unusual: a Java that looks substantively different from Java 8. Not just faster or more convenient — different in how you model domains and reason about concurrency.&lt;/p&gt;&#xA;&lt;p&gt;This article focuses on the features that arrived between Java 17 and Java 21 (covered separately) and the cohesive picture they form together.&lt;/p&gt;&#xA;&lt;h2 id=&#34;pattern-matching-for-switch-finalized-java-21&#34;&gt;Pattern Matching for Switch (Finalized Java 21)&lt;/h2&gt;&#xA;&lt;p&gt;Pattern matching for &lt;code&gt;instanceof&lt;/code&gt; arrived in Java 16. Java 21 extended pattern matching to &lt;code&gt;switch&lt;/code&gt; — and this is where the power becomes apparent.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Virtual Threads in Java 21: What They Solve and What They Don&#39;t</title>
				<link>https://dplabs.tech/blog/virtual-threads-java-21/</link>
				<pubDate>Mon, 04 Nov 2024 00:00:00 +0000</pubDate>
				<guid>https://dplabs.tech/blog/virtual-threads-java-21/</guid>
				<description>&lt;p&gt;Virtual threads were the most anticipated Java feature in years. Project Loom&amp;rsquo;s promise was simple: write blocking code that scales like non-blocking code. Java 21 delivered them as a finalized, production-ready feature. They work. The caveats matter.&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-problem-virtual-threads-solve&#34;&gt;The Problem Virtual Threads Solve&lt;/h2&gt;&#xA;&lt;p&gt;Traditional Java concurrency has a fundamental constraint: &lt;strong&gt;platform threads are expensive&lt;/strong&gt;. Each platform thread maps 1:1 to an OS thread. OS threads consume roughly 1MB of stack space by default and are expensive to create and context-switch.&lt;/p&gt;</description>
			</item>
	</channel>
</rss>
