@Override
  public void setHosts(Map<Long, Host> hosts) {
    hostLock.writeLock().lock();
    try {
      // persist enitites in a transaction first, then update internal state
      replaceHostMappings(hosts);
      m_hosts = new ConcurrentHashMap<>(hosts);
    } finally {
      hostLock.writeLock().unlock();
    }
  }
Helper method to recreate host mapping
@param hosts
ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java