@Override
  public int getClusterSize(String clusterName) {
    int hostCount = 0;
    ConcurrentHashMap<String, Set<Host>> clusterHostsMap = getClusterHostsMap();
    Set<Host> hosts = clusterHostsMap.get(clusterName);
    if (null != hosts) {
      hostCount = clusterHostsMap.get(clusterName).size();
    }

    return hostCount;
  }
Returns the number of hosts that form the cluster identified by the given name.

@param clusterName the name that identifies the cluster
@return number of hosts that form the cluster
ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java