Code Room
Code reviewMedium
Question
Review this Java breaker that opens after 5 failures and is supposed to protect a downstream.
What a strong answer looks like
Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.
Learn the concepts
class Breaker { private int failures = 0; <T> T call(Supplier<T> fn) { if (failures >= 5) throw new BreakerOpenException(); try { T r = fn.get(); return r; // success: counter untouched } catch (RuntimeException e) { failures++; throw e; } }}Run or narrate your approach, then ask the coach.