private Long translateStrToLong(String value) {
if (org.apache.commons.lang.StringUtils.isAlphanumeric(value)) {
return Long.valueOf(value);
}
return 0L;
}
private Map<String, String> parseTelnetResult(String rs) {
//The output contains multiple lines with the following format:
//key \t value
String[] resultArray = rs.split("\n");
Map<String, String> resultMap = new HashMap<String, String>();
for (String recordLine : resultArray) {
String[] recordKeyValue = recordLine.split("\t");
LOGGER.debug("############recordKeyValue.size:" + recordKeyValue.length + " recordKeyValue:" + Arrays.toString(recordKeyValue));
if (recordKeyValue != null && recordKeyValue.length == 2) {
resultMap.put(recordKeyValue[0], recordKeyValue[1]);
}
}
return resultMap;
}
public static void main(String[] args) {
System.out.println(new ZookeeperDataProvider().extractMonitorData());
}
}
--------------------------------------分割线 --------------------------------------
Ubuntu 14.04安装分布式存储Sheepdog+ZooKeeper
CentOS 6安装sheepdog 虚拟机分布式储存