Add java21-to-25 module: compile-once probes on JDK 21 and 25, removed APIs, build matrix, pinning, compact headers and containers
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b7N4ZDbUtA3ofqAqRV
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import java.util.concurrent.StructuredTaskScope;
|
||||
|
||||
/** The Java 21 shape of structured concurrency (JEP 453): new ShutdownOnFailure(). */
|
||||
public class StructuredTaskDemo {
|
||||
public static void main(String[] args) throws Exception {
|
||||
try (var scope = new StructuredTaskScope.ShutdownOnFailure()) {
|
||||
var user = scope.fork(() -> "user-7");
|
||||
var order = scope.fork(() -> "order-42");
|
||||
scope.join().throwIfFailed();
|
||||
System.out.println(user.get() + " " + order.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user