<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Scoped-Values on Devops Monk</title><link>https://devops-monk.com/tags/scoped-values/</link><description>Recent content in Scoped-Values on Devops Monk</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Mon, 04 May 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://devops-monk.com/tags/scoped-values/index.xml" rel="self" type="application/rss+xml"/><item><title>Scoped Values (JEP 446): Thread-Safe Context Without ThreadLocal</title><link>https://devops-monk.com/tutorials/java21/scoped-values/</link><pubDate>Mon, 04 May 2026 00:00:00 +0000</pubDate><guid>https://devops-monk.com/tutorials/java21/scoped-values/</guid><description>Preview Feature — Requires --enable-preview at compile and runtime.
The ThreadLocal Problem at Scale ThreadLocal has been the standard way to pass context (request ID, user session, database transaction) implicitly through a call stack without threading it through every method signature. It works well with a few hundred platform threads. With virtual threads, it breaks down.
Problem 1 — Memory overhead with inheritance
When you create a child thread with InheritableThreadLocal, Java copies the thread-local map from parent to child:</description></item></channel></rss>