Java 27 and 26: runnable demos and captured output for every JEP, plus version lanes
Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01B38FGKKam5SCGgwgduVAh3
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
$ java --enable-preview StructuredDemo (JDK 27)
|
||||
--- allSuccessfulOrThrow(): results as a List, failures as ExecutionException
|
||||
results = [price=42, stock=7]
|
||||
CHECK ok : join() returns the subtask results in fork order
|
||||
caught java.util.concurrent.ExecutionException with cause java.lang.IllegalStateException: inventory service is down
|
||||
CHECK ok : a failing subtask surfaces as ExecutionException(cause)
|
||||
--- allSuccessfulOrThrow(Function): join() throws the exception type you choose
|
||||
caught OrderFailed: order failed: inventory service is down
|
||||
CHECK ok : the mapped exception wraps the original failure
|
||||
--- withTimeout(...): what happens when the scope runs out of time
|
||||
caught java.util.concurrent.ExecutionException
|
||||
cause: java.util.concurrent.StructuredTaskScope$CancelledByTimeoutException
|
||||
CHECK ok : a timeout is reported as CancelledByTimeoutException
|
||||
exit=0
|
||||
Reference in New Issue
Block a user