Follow-up · depth 8
Design a small subsystem that relies on CompletableFuture Composition
Design a small subsystem that relies on CompletableFuture Composition
Answers use simple, clear English.
Audio N/AQuick interview answer
Sketch components, data flow, failure modes, and metrics around CompletableFuture Composition. Example shape: Aggregate microservice responses: CompletableFuture.allOf(userF, ordersF).thenApply(...).
Detailed answer
Mini design using CompletableFuture Composition: • Components: API edge, worker/queue, store, and observability. • Data flow: request → CompletableFuture Composition-related path → response/async side effects. • Failure modes: timeouts, overload, partial dependency loss. • Metrics: latency, errors, saturation for the CompletableFuture Composition path. Guardrails: 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
Interviewers want a crisp architecture story anchored on CompletableFuture Composition, not a buzzword list. 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 →