@SuppressWarnings("rawtypes")
private void init() throws Exception {
NimbusClient client = null;
ClusterState cluster_state = null;
try {
LOG.info("MainPage init...");
Map conf = UIUtils.readUiConfig();
if(clusterName != null && !(clusterName.equals(""))) {
UIUtils.getClusterInfoByName(conf, clusterName);
}
client = NimbusClient.getConfiguredClient(conf);
summ = client.getClient().getClusterInfo();
tsumm = UIUtils.topologySummary(summ.get_topologies());
csumm = UIUtils.clusterSummary(summ, client, conf);
ssumm = UIUtils.supervisorSummary(summ.get_supervisors());
cluster_state = ZkTool.mk_distributed_cluster_state(client
.getConf());
slaves = getNimbusSlave(cluster_state, conf);
zkServers = getZkServer(conf);
zkPort = String.valueOf(conf.get(Config.STORM_ZOOKEEPER_PORT));
} catch (Exception e) {
String errorInfo = e.getMessage();
if (errorInfo.indexOf("No alive nimbus") == -1) {
LOG.error("Failed to get cluster information:", e);
throw e;
}
} finally {
if (client != null) {
client.close();
}
if (cluster_state != null) {
cluster_state.close();
}
}
}