8341903: Implementation of Scoped Values (Fourth Preview)

Reviewed-by: alanb
This commit is contained in:
Andrew Haley 2024-11-05 17:12:17 +00:00
parent 839de82c31
commit 3fab8e37bb
7 changed files with 88 additions and 157 deletions

View file

@ -261,8 +261,8 @@ import jdk.internal.invoke.MhUtil;
* {@snippet lang=java :
* private static final ScopedValue<String> USERNAME = ScopedValue.newInstance();
*
* // @link substring="runWhere" target="ScopedValue#runWhere(ScopedValue, Object, Runnable)" :
* ScopedValue.runWhere(USERNAME, "duke", () -> {
* // @link substring="run" target="ScopedValue.Carrier#run(Runnable)" :
* ScopedValue.where(USERNAME, "duke").run(() -> {
* try (var scope = new StructuredTaskScope<String>()) {
*
* scope.fork(() -> childTask()); // @highlight substring="fork"