Code Room
Code reviewMediumcr-g599
Subject Http keepalive churnLevel Mid–Senior~20 minCommon in Networking & APIs interviewsIndustries Software development, Technology

Question

Review this Java client that calls a downstream service in a loop.

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
String fetch(String id) throws Exception {    URL url = new URL("https://svc.internal/items/" + id);    HttpURLConnection c = (HttpURLConnection) url.openConnection();    c.setRequestMethod("GET");    try (InputStream in = c.getInputStream()) {        return new String(in.readAllBytes(), StandardCharsets.UTF_8);    } finally {        c.disconnect();    }}
Run or narrate your approach, then ask the coach.