Code Room
Code reviewHardcr-g310
Subject Timeout handlingLevel Senior–Staff~22 minCommon in Networking & APIs interviewsIndustries Software development

Question

Review this Java HTTP client used for all calls to a third-party API. Occasionally threads pile up and the request pool exhausts.

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
@Configurationclass HttpConfig {    @Bean    RestTemplate client() {        SimpleClientHttpRequestFactory f = new SimpleClientHttpRequestFactory();        f.setConnectTimeout(2000);        return new RestTemplate(f);    }} @Serviceclass PartnerClient {    private final RestTemplate client;    PartnerClient(RestTemplate client) { this.client = client; }     Quote getQuote(String sku) {        return client.getForObject("https://partner.example/q/" + sku, Quote.class);    }}
Run or narrate your approach, then ask the coach.