Code Room
Code reviewHardcr-g414
Subject Thread safetyLevel Senior–Staff~30 minCommon in Concurrency interviewsIndustries Software development

Question

Review this Java background loader. One thread runs `loadLoop()`; request threads call `current()`.

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
class ConfigCache {  private Map<String,String> config = Collections.emptyMap();   void reload(Map<String,String> fresh) {    config = fresh;          // swap reference  }   String get(String key) {    return config.get(key);  // read  }}
Run or narrate your approach, then ask the coach.