Follow-up · depth 9
How do you make CompletableFuture Composition safer under partial failure?
How do you make CompletableFuture Composition safer under partial failure?
Answers use simple, clear English.
Quick interview answer
Harden CompletableFuture Composition with timeouts, retries with jitter, isolation, and graceful degradation. Logic: supplyAsync runs async task; thenApply transforms; thenCompose flattens nested futures; allOf waits for batch. Exceptionally/handle for error paths.
Detailed answer
Resilience for CompletableFuture Composition under partial failure: • Timeouts + budgets on every dependency call • Retries only when idempotent, with jitter/backoff • Isolation: bulkheads/queues so one failure does not cascade • Degradation: serve stale/cached/limited mode when needed Practices: Specify executor for IO; use orTimeout/join with timeout in Java 9+. Parent context: Logic: supplyAsync runs async task; thenApply transforms; thenCompose flattens nested futures; allOf waits for batch. Exceptionally/handle for error paths.
Full explanation
Partial failure is the default in distributed systems — show how CompletableFuture Composition stays useful anyway. 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
Logic: supplyAsync runs async task; thenApply transforms; thenCompose flattens nested futures; allOf waits for batch. Exceptionally/handle for error paths.
View full parent question →