Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b3dRuKRhrHFPzWSSxr
24 lines
1.1 KiB
Plaintext
24 lines
1.1 KiB
Plaintext
== 1. What does exceptionally() receive?
|
|
supplyAsync threw, exceptionally on same stage: CompletionException <- cause IllegalStateException: boom
|
|
completeExceptionally(raw), same stage: IllegalStateException: boom
|
|
completeExceptionally(raw), one stage later: CompletionException <- cause IllegalStateException: boom
|
|
|
|
== 2. What do join() and get() throw?
|
|
join(): CompletionException <- cause IllegalStateException: boom
|
|
get(): ExecutionException <- cause IllegalStateException: boom
|
|
state() = FAILED, exceptionNow() = IllegalStateException: boom
|
|
|
|
== 3. exceptionally vs handle vs whenComplete
|
|
exceptionally(ex -> -1) -> -1
|
|
handle((v, ex) -> ex==null?v:-2) -> -2
|
|
whenComplete saw: CompletionException <- cause IllegalStateException: boom
|
|
whenComplete did not recover; join(): CompletionException <- cause IllegalStateException: boom
|
|
|
|
== 4. On success, each one is a pass-through or a transformer
|
|
exceptionally on success: 7
|
|
handle on success: 14
|
|
whenComplete on success: 7
|
|
|
|
== 5. exceptionallyCompose: recover with another async call (JDK 12+)
|
|
recovered value: 99
|