File tree Expand file tree Collapse file tree 5 files changed +13
-8
lines changed
src/main/java/net/codetojoy Expand file tree Collapse file tree 5 files changed +13
-8
lines changed Original file line number Diff line number Diff line change 1+
2+
3+ - key page: https://download.java.net/java/early_access/jdk25/docs/api/java.base/java/util/concurrent/StructuredTaskScope.Joiner.html
4+
5+ - Gradle: not yet
6+
7+ - egg5
8+ - ok for bash, Maven
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ TARGET_DIR=$ROOT_DIR/my_build/main
1010
1111mkdir -p $TARGET_DIR
1212
13- javac --release 21 --enable-preview \
13+ javac --release 25 --enable-preview \
1414-cp $CLASSPATH \
1515-d $TARGET_DIR ` find $SRC_DIR -name " *.java" `
1616
Original file line number Diff line number Diff line change 1313
1414 <properties >
1515 <project .build.sourceEncoding>UTF-8</project .build.sourceEncoding>
16- <maven .compiler.source>19 </maven .compiler.source>
17- <maven .compiler.target>19 </maven .compiler.target>
16+ <maven .compiler.source>25 </maven .compiler.source>
17+ <maven .compiler.target>25 </maven .compiler.target>
1818 </properties >
1919
2020 <dependencies >
4545 <configuration >
4646 <compilerArgs >
4747 <arg >--enable-preview</arg >
48- <arg >--add-modules=jdk.incubator.concurrent</arg >
4948 </compilerArgs >
5049 </configuration >
5150 </plugin >
8281 <configuration >
8382 <executable >${java.home} /bin/java</executable >
8483 <arguments >
85- <argument >--add-modules=jdk.incubator.concurrent</argument >
8684 <argument >--enable-preview</argument >
8785 <argument >--class-path</argument >
8886 <classpath />
Original file line number Diff line number Diff line change @@ -9,7 +9,6 @@ CLASSPATH=$CLASSPATH:$TARGET_DIR
99
1010java --enable-preview \
1111-cp $CLASSPATH \
12- --add-modules jdk.incubator.concurrent \
1312net.codetojoy.Runner
1413
1514echo " run complete"
Original file line number Diff line number Diff line change 44
55import java .time .Duration ;
66import java .util .concurrent .*;
7+ import java .util .concurrent .StructuredTaskScope .Joiner ;
78
89public class Runner {
910 long taskFooDelayInMillis = 1000L ;
@@ -30,12 +31,11 @@ String taskBar() {
3031 }
3132
3233 String run () throws Exception {
33- try (var scope = new StructuredTaskScope .ShutdownOnFailure ( )) {
34+ try (var scope = StructuredTaskScope .open ( Joiner .< String > awaitAllSuccessfulOrThrow () )) {
3435 var foo = scope .fork (() -> taskFoo ());
3536 var bar = scope .fork (() -> taskBar ());
3637
3738 scope .join (); // Join both forks
38- scope .throwIfFailed (); // and propagate errors
3939
4040 // Here, both forks have succeeded, so compose their results
4141 return foo .get () + " " + bar .get ();
You can’t perform that action at this time.
0 commit comments