Follow-up · depth 14
What are common failure modes of CompletableFuture Composition?
What are common failure modes of CompletableFuture Composition?
Answers use simple, clear English.
Quick interview answer
Common failures around CompletableFuture Composition: blocking the hot path, ignoring backpressure, and weak timeout/retry design. Blocking get() on async chain in request thread; lost exceptions without handle.
Detailed answer
Failure modes for CompletableFuture Composition: Known pitfalls: Blocking get() on async chain in request thread; lost exceptions without handle. • Missing timeouts / unbounded retries • No backpressure when downstream slows • Assuming ordering/guarantees the runtime does not provide How seniors prevent them: Specify executor for IO; use orTimeout/join with timeout in Java 9+. Parent context: Baseline: supplyAsync runs async task; thenApply transforms; thenCompose flattens nested futures; allOf waits for batch. Exceptionally/handle for error paths.
Full explanation
Name concrete failure modes and the mitigation for each — that scores higher than a vague “it can fail.” supplyAsync runs async task; thenApply transforms; thenCompose flattens nested futures; allOf waits for batch. Exceptionally/handle for error paths.
Follow-up questions
Only answered follow-ups are shown — click to open with full answers
Parent context — CompletableFuture Composition
Baseline: supplyAsync runs async task; thenApply transforms; thenCompose flattens nested futures; allOf waits for batch. Exceptionally/handle for error paths.
View full parent question →