Skip to content

Files

Latest commit

f9d8437 · Feb 21, 2023

History

History
33 lines (23 loc) · 754 Bytes

README.md

File metadata and controls

33 lines (23 loc) · 754 Bytes

Scoped Values

The Scoped Values API allows us to store and share immutable data for a bounded lifetime. It has been included in the JDK since Java 20 as an incubator API. This repository shows how you can use it with Virtual Threads and Structured Concurrency.

Requirement

JDK 20 or later

Ho to compile?

mvn clean install
jar cmf ./META-INF/MANIFEST.FM scoped-values.jar -C ./target/classes/ .

or

sh ./compile.sh   

Ho to run?

java --enable-preview --add-modules jdk.incubator.concurrent -jar scoped-values.jar

or

sh ./run.sh   

Relevant article is

An introduction to Scoped Values in Java