completablefuture: CompletableFuture module (thenApply vs thenCompose and the serial trap, which thread runs a stage incl. join() running dependents, CompletionException wrapping, orTimeout/cancel not stopping work, allOf/anyOf with fail-fast and first-success helpers, virtual-thread timings, StructuredTaskScope preview error), 26 contract tests

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b3dRuKRhrHFPzWSSxr
This commit is contained in:
Ankur Mhatre
2026-11-22 18:56:47 +05:30
co-authored by Claude Sonnet 5.5
parent 59a5435825
commit 9c2ae10d7f
25 changed files with 1335 additions and 0 deletions
@@ -0,0 +1,17 @@
availableProcessors = 2
common pool parallelism = 1
caller thread = main
== Stage registered WHILE the previous stage is still running
supplyAsync body ran on ForkJoinPool.commonPool-worker-1
thenApply (registered before slow finished) ran on ForkJoinPool.commonPool-worker-1
thenApplyAsync (no executor) ran on ForkJoinPool.commonPool-worker-1
thenApplyAsync (executor = mine) ran on my-pool-1
== Stage registered AFTER the previous stage finished
thenApply (registered after slow finished) ran on main
thenApply on completedFuture(..) ran on main
== Supplying with your own executor
supplyAsync(.., mine) body ran on my-pool-2
thenApply after supplyAsync(.., mine) ran on my-pool-2