private static String getMode(String hostPort) throws NumberFormatException, UnknownHostException, IOException {
String parts[] = hostPort.split(":");
Socket s = new Socket(parts[0], Integer.parseInt(parts[1]));
s.getOutputStream().write("stat".getBytes());
BufferedReader br = new BufferedReader(new InputStreamReader(s.getInputStream()));
String line;
try {
while((line = br.readLine()) != null) {
if (line.startsWith("Mode: ")) {
return line.substring(6);
}
}
return "unknown";
} finally {
s.close();
}
}
GenerateLoad.java 文件源码
java
阅读 49
收藏 0
点赞 0
评论 0
项目:ZooKeeper
作者:
评论列表
文章目录