< prev index next >

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

Print this page
@@ -155,11 +155,12 @@
   *
   * {@snippet lang=java :
   *     private static final ScopedValue<String> NAME = ScopedValue.newInstance();
  
   *     ScopedValue.where(NAME, "duke").run(() -> {
-  *         try (var scope = new StructuredTaskScope<String>()) {
+  *         // @link substring="open" target="StructuredTaskScope#open()" :
+  *         try (var scope = StructuredTaskScope.open()) {
   *
   *              // @link substring="fork" target="StructuredTaskScope#fork(java.util.concurrent.Callable)" :
   *              scope.fork(() -> childTask1());
   *              scope.fork(() -> childTask2());
   *              scope.fork(() -> childTask3());
< prev index next >