processes = zkClient.getChildren(processPath);
taskNumber = tasks.size();
for (int i = 0; i < processes.size(); i++) {
ZNRecord process = zkClient.readData(processPath + "/" + processes.get(i), true);
if (process != null) {
int partition = Integer.parseInt(process.getSimpleField("partition"));
String host = process.getSimpleField("host");
int port = Integer.parseInt(process.getSimpleField("port"));
String taskId = process.getSimpleField("taskId");
ClusterNode node = new ClusterNode(partition, port, host, taskId);
nodes.add(node);
}
}
app = new App();
app.cluster = clusterName;
try {
ZNRecord appRecord = zkClient.readData(appPath);
app.name = appRecord.getSimpleField("name");
app.uri = appRecord.getSimpleField("s4r_uri");
} catch (ZkNoNodeException e) {
logger.warn(appPath + " doesn't exist");
}
}