public static SessionRemote getMasterSessionRemote(Properties info) {
return getSessionRemote(info, HBaseUtils.getMasterURL());
}
public static SessionRemote getSessionRemote(Properties info, String url) {
SessionRemote sr = getQueue(url).poll();
if (sr == null || sr.isClosed()) {
byte[] userPasswordHash = null;
byte[] filePasswordHash = null;
Properties prop = new Properties();
String key;
for (Object o : info.keySet()) {
key = o.toString();
if (key.equalsIgnoreCase("_userPasswordHash_"))
userPasswordHash = (byte[]) info.get(key);
else if (key.equalsIgnoreCase("_filePasswordHash_"))
filePasswordHash = (byte[]) info.get(key);
else
prop.setProperty(key, info.getProperty(key));
}
ConnectionInfo ci = new ConnectionInfo(url, prop);
ci.setUserPasswordHash(userPasswordHash);
ci.setFilePasswordHash(filePasswordHash);
sr = (SessionRemote) new SessionRemote(ci).connectEmbeddedOrServer(false);
}
return sr;
}