use of com.ms.silverking.cloud.zookeeper.ZooKeeperExtended in project SilverKing by Morgan-Stanley.
the class SuspectsZK method _readAccuserSuspectsFromZKAsString.
/**
* Read accuser->suspects map from zookeeper as strings.
* @return accuser->suspects map
* @throws KeeperException
*/
private SetMultimap<String, String> _readAccuserSuspectsFromZKAsString() throws KeeperException {
String basePath;
List<String> accusers;
SetMultimap<String, String> accuserSuspectsMap;
ZooKeeperExtended _zk;
basePath = mc.getMetaPaths().getInstanceSuspectsPath();
_zk = mc.getZooKeeper();
accusers = _zk.getChildren(basePath);
accuserSuspectsMap = HashMultimap.create();
for (String accuser : accusers) {
String suspectsDef;
suspectsDef = _zk.getString(basePath + "/" + accuser.toString());
if (!suspectsDef.equals(emptySetDef)) {
suspectsDef.trim();
suspectsDef = suspectsDef.substring(1, suspectsDef.length() - 1);
for (String suspect : suspectsDef.split(suspectsDelimiterString)) {
accuserSuspectsMap.put(accuser, suspect);
}
}
}
return accuserSuspectsMap;
}
use of com.ms.silverking.cloud.zookeeper.ZooKeeperExtended in project SilverKing by Morgan-Stanley.
the class SuspectsZK method readActiveNodesFromZK.
public Set<IPAndPort> readActiveNodesFromZK() throws KeeperException {
String basePath;
ZooKeeperExtended _zk;
basePath = mc.getMetaPaths().getInstanceSuspectsPath();
_zk = mc.getZooKeeper();
return ImmutableSet.copyOf(IPAndPort.list(_zk.getChildren(basePath)));
}
use of com.ms.silverking.cloud.zookeeper.ZooKeeperExtended in project SilverKing by Morgan-Stanley.
the class MetaClient method getDHTConfiguration.
public DHTConfiguration getDHTConfiguration() throws KeeperException {
String def;
long version;
String latestPath;
long zkid;
ZooKeeperExtended zk;
zk = getZooKeeper();
latestPath = zk.getLatestVersionPath(getMetaPaths().getInstanceConfigPath());
version = zk.getLatestVersionFromPath(latestPath);
def = zk.getString(latestPath);
zkid = zk.getStat(latestPath).getMzxid();
// System.out.printf("\tzkid %x\n", zkid);
return DHTConfiguration.parse(def, version, zkid);
}
Aggregations