File tree Expand file tree Collapse file tree 5 files changed +13
-11
lines changed
src/main/java/net/codetojoy Expand file tree Collapse file tree 5 files changed +13
-11
lines changed Original file line number Diff line number Diff line change 88 - ok for bash, Maven
99- egg6
1010 - ok for bash, Maven
11+ - egg7
12+ - 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 33package net .codetojoy ;
44
55import java .time .*;
6+ import java .util .List ;
67import java .util .concurrent .StructuredTaskScope ;
8+ import java .util .concurrent .StructuredTaskScope .Joiner ;
9+ import java .util .concurrent .StructuredTaskScope .Subtask ;
710
811public class Runner {
912 long taskFooDelayInMillis = 20000L ;
@@ -30,14 +33,14 @@ String taskBar() {
3033 }
3134
3235 String run () throws Exception {
33- try (var scope = new StructuredTaskScope .ShutdownOnSuccess <String >()) {
36+ Duration timeout = Duration .ofSeconds (2 );
37+
38+ try (var scope = StructuredTaskScope .open (Joiner .<String >anySuccessfulResultOrThrow (),
39+ cf -> cf .withTimeout (timeout ))) {
3440 var foo = scope .fork (() -> taskFoo ());
3541 var bar = scope .fork (() -> taskBar ());
3642
37- var deadline = Instant .now ().plusSeconds (2 );
38- scope .joinUntil (deadline );
39-
40- return scope .result ();
43+ return scope .join ();
4144 }
4245 }
4346
You can’t perform that action at this time.
0 commit comments