Scoped Value

Turkish equivalent: Kapsamlı değerDomain: Java and JVM

A Java mechanism for sharing immutable contextual data with callees and child tasks within a bounded dynamic scope.

JVM Runtime Context

Scoped Values provide immutable contextual data to callees and child tasks within a bounded dynamic scope. They are useful for request identity, tracing context, and similar data that would otherwise be threaded through many method parameters. JDK 25 exposes the mechanism as a final API.

State Boundary

Scoped Values are not a general mutable replacement for ThreadLocal. Binding is intentionally constrained by scope, which is central to predictable use with virtual threads and structured concurrency.

Source

  • https://openjdk.org/jeps/506