@Override
@Transactional
public synchronized Host getHost(String hostname) throws AmbariException {
if (!hosts.containsKey(hostname)) {
HostEntity hostEntity = hostDAO.findByName(hostname);
if (hostEntity != null) {
Host host = hostFactory.create(hostEntity, true);
Set<Cluster> cSet = new HashSet<Cluster>();
hosts.put(hostname, host);
hostClusterMap.put(hostname, cSet);
for (ClusterEntity clusterEntity : hostEntity.getClusterEntities()) {
if (clustersById.containsKey(clusterEntity.getClusterId())) {
cSet.add(clustersById.get(clusterEntity.getClusterId()));
} else {
cSet.add(getClusterById(clusterEntity.getClusterId()));
}