Skip to main content

Checkpoint: bounded fan-out, collected as values

Challenge on lesson: Checkpoint: The Deadline-Scoped Aggregator

Inside Solution, implement the deadline aggregator: 1. static List<String> aggregate(List<Integer> ids, Executor executor) — for each id, run a task that sleeps id ms (simulated work) and returns "id-<id>-ok" IF id is even; odd ids sleep then throw. Bound EACH branch with orTimeout(80, MILLISECONDS) and recover with handle → failure mode string: "id-<id>-timeout" for timeouts, "id-<id>-error" for other exceptions. 2. Aggregate with allOf(...).orTimeout(500, MILLISECONDS), then join in submission order and return the list. Every id must appear exactly once — failures included. 3. static String philosophy() returns exactly: "per-branch bounds degrade dependencies; the aggregate bound protects the caller; failures are values".

Difficulty: advanced

Back to lesson: Checkpoint: The Deadline-Scoped Aggregator