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:
co-authored by
Claude Sonnet 5.5
parent
59a5435825
commit
9c2ae10d7f
@@ -0,0 +1,11 @@
|
||||
== 1. thenApply with a function that itself returns a CompletableFuture
|
||||
nested.join() is a: CompletableFuture
|
||||
inner.join() is: Order[userId=1, item=laptop]
|
||||
|
||||
== 2. thenCompose flattens it
|
||||
flat.join() is: Order[userId=1, item=laptop]
|
||||
|
||||
== 3. Same three tools, measured (fixed pool of 4, so nothing queues)
|
||||
dependent calls: thenCompose (100 ms then 150 ms) -> Order[userId=1, item=laptop] 251 ms
|
||||
independent calls: start both, then thenCombine -> ankur + winter-sale 125 ms
|
||||
independent calls, wrongly chained with thenCompose -> ankur + winter-sale 221 ms
|
||||
Reference in New Issue
Block a user