< prev index next >

src/java.base/share/classes/java/lang/ScopedValue.java

Print this page
@@ -156,17 +156,22 @@
   *
   * {@snippet lang=java :
   *     private static final ScopedValue<String> NAME = ScopedValue.newInstance();
  
   *     ScopedValue.runWhere(NAME, "duke", () -> {
-  *         try (var scope = new StructuredTaskScope<String>()) {
+  *         // @link substring="open" target="StructuredTaskScope#open(Policy)" :
+  *         try (var scope = StructuredTaskScope.open(policy)) {
   *
+  *             // @link substring="fork" target="StructuredTaskScope#fork(java.util.concurrent.Callable)" :
   *             scope.fork(() -> childTask1());
   *             scope.fork(() -> childTask2());
   *             scope.fork(() -> childTask3());
   *
   *             ...
+  *
+  *             // @link substring="join" target="StructuredTaskScope#join()" :
+  *             var result = scope.join();
   *          }
   *     });
   * }
   *
   * <p> Unless otherwise specified, passing a {@code null} argument to a method in this
< prev index next >