fix otherConn null

web_backend_develope
lily 9 years ago
parent 4002c4d74d
commit 9b311366a5

@ -41,7 +41,7 @@ public class ClusterInfo {
public Map<String, String> showClusterInfo() {
log.info("get cluster info");
Map<String, String> peerIps = new HashMap<String, String>();
peerIps.put(Constant.hostIp, Constant.peerincluster_connected);
List<String> reStrings = Constant.ganymedSSH.execCmdWaitAcquiescent(Constant.glusterPeerStatus);
if (reStrings == null) {
log.error("1101 command get result is null");
@ -93,6 +93,9 @@ public class ClusterInfo {
for (Map.Entry<String, String> entry:peerIps.entrySet()){
String key=entry.getKey();
String value=entry.getValue();
if(Constant.ganymedSSH.otherConns==null){
Constant.ganymedSSH.otherConns=new HashMap<String,Connection>();
}
if(!Constant.ganymedSSH.otherConns.containsKey(key)){
Connection connection=null;
try {
@ -104,7 +107,7 @@ public class ClusterInfo {
Constant.ganymedSSH.otherConns.put(key,connection);
}
}
peerIps.put(Constant.hostIp, Constant.peerincluster_connected);
return peerIps;
}

@ -1,10 +1,13 @@
package com.platform.utils;
import java.util.HashMap;
import java.util.Properties;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import ch.ethz.ssh2.Connection;
public class ConfigsLoader implements ServletContextListener {
private static ConfigPropertyReader cReader = null;
@ -65,6 +68,7 @@ public class ConfigsLoader implements ServletContextListener {
Constant.hostIp=properties.getProperty("gfs_control_ip").trim();
Constant.rootPasswd=properties.getProperty("gfs_control_rootPassWd").trim();
Constant.ganymedSSH = new GanymedSSH(Constant.hostIp, Constant.rootUser, Constant.rootPasswd, Constant.port);
Constant.ganymedSSH.otherConns=new HashMap<String,Connection>();
}
public ConfigPropertyReader getcReader() {

@ -1,6 +1,7 @@
package com.platform.utils;
import java.util.HashMap;
public class Constant {
public static String rootUser = "root";

Loading…
Cancel
Save