Authored by jack

修改主从显示错误

... ... @@ -83,7 +83,7 @@ public class RedisTask extends Task {
for (String item : itemArray) {
if (item.startsWith("#") || item.startsWith("\r\n")) {
if (item.startsWith("#") || item.startsWith("\r\n") || item.startsWith(" ")) {
continue;
}
... ... @@ -146,7 +146,29 @@ public class RedisTask extends Task {
if (entry.getKey().startsWith("slave")) {
slaveInfo.concat("slave: " + entry.getValue() + "\r\n");
String slaveItem = "";
String info = entry.getValue();
String[] infos = info.split(",");
for (String in : infos) {
if (in.startsWith("ip=")) {
slaveItem = slaveItem.concat(in.split("=")[1]);
slaveItem = slaveItem.concat(":");
}
if (in.startsWith("port=")) {
slaveItem = slaveItem.concat(in.split("=")[1]);
}
if (in.startsWith("state=")) {
slaveItem = slaveItem.concat(" ");
slaveItem = slaveItem.concat(in.split("=")[1]);
}
}
slaveInfo = slaveInfo.concat("slave: " + entry.getValue() + "\r\n");
}
}
... ... @@ -157,7 +179,7 @@ public class RedisTask extends Task {
String masterInfo = "";
masterInfo.concat("master: " + infoMap.get("master_host") + "," + infoMap.get("master_port") + "," + infoMap.get("master_link_status"));
masterInfo = masterInfo.concat("master: " + infoMap.get("master_host") + "," + infoMap.get("master_port") + "," + infoMap.get("master_link_status"));
redisInfo.setMasters(masterInfo);
... ... @@ -178,4 +200,5 @@ public class RedisTask extends Task {
return redisInfo;
}
}
... ...