class ReplicaMap {

  ReplicaInfo add(String bpid, ReplicaInfo replicaInfo) {
    checkBlockPool(bpid);
    checkBlock(replicaInfo);
    synchronized (mutex) {
      Map<Long, ReplicaInfo> m = map.get(bpid);
      if (m == null) {
        // Add an entry for block pool if it does not exist already
        m = new HashMap<>();
        map.put(bpid, m);
      }
      return m.put(replicaInfo.getBlockId(), replicaInfo);
    }
  }

    ReplicaMap(Object mutex);

}