Code Room
Code reviewHardcr-g498
Subject Timeout handlingLevel Senior–Staff~20 minCommon in Code quality & review interviewsIndustries Software development, Technology

Question

Review this Java client. `paymentClient` internally retries 3 times with 1s backoff (up to ~4s) before giving up.

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.

Talk through your review
Code to reviewjava
Future<ChargeResult> f = executor.submit(() -> paymentClient.charge(req));try {    return f.get(1, TimeUnit.SECONDS);} catch (TimeoutException e) {    f.cancel(true);    return retryCharge(req); // our own retry: submit again, get(1s) again}
Run or narrate your approach, then ask the coach.