mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8341903: Implementation of Scoped Values (Fourth Preview)
Reviewed-by: alanb
This commit is contained in:
parent
839de82c31
commit
3fab8e37bb
7 changed files with 88 additions and 157 deletions
|
@ -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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue