use of com.ms.silverking.cloud.zookeeper.ZooKeeperExtended in project SilverKing by Morgan-Stanley.
the class ExclusionZKBase method readFromZK.
@Override
public ExclusionSet readFromZK(long version, MetaToolOptions options) throws KeeperException {
String vBase;
// List<String> nodes;
String[] nodes;
Stat stat;
ZooKeeperExtended _zk;
_zk = mc.getZooKeeper();
if (version == VersionedDefinition.NO_VERSION) {
version = _zk.getLatestVersion(base);
}
vBase = getVBase(version);
// nodes = zk.getChildren(vBase);
stat = new Stat();
nodes = _zk.getString(vBase, null, stat).split("\n");
return new ExclusionSet(ImmutableSet.copyOf(nodes), version, stat.getMzxid());
}
use of com.ms.silverking.cloud.zookeeper.ZooKeeperExtended in project SilverKing by Morgan-Stanley.
the class ExclusionZKBase method getLatestZKPath.
public String getLatestZKPath() throws KeeperException {
long version;
ZooKeeperExtended _zk;
_zk = mc.getZooKeeper();
version = _zk.getLatestVersion(exclusionsPath);
if (version < 0) {
return null;
} else {
return getVBase(version);
}
}
use of com.ms.silverking.cloud.zookeeper.ZooKeeperExtended in project SilverKing by Morgan-Stanley.
the class ExclusionZKBase method readNodesAsSet.
private Set<String> readNodesAsSet(String path, Stat stat) throws KeeperException {
String[] nodes;
ZooKeeperExtended _zk;
_zk = mc.getZooKeeper();
nodes = _zk.getString(path, null, stat).split("\n");
return ImmutableSet.copyOf(nodes);
}
use of com.ms.silverking.cloud.zookeeper.ZooKeeperExtended in project SilverKing by Morgan-Stanley.
the class MetaClient method getSKFSConfig.
public String getSKFSConfig() throws KeeperException {
String def;
// long version;
String latestPath;
// long zxid;
ZooKeeperExtended zk;
zk = getZooKeeper();
latestPath = zk.getLatestVersionPath(getMetaPaths().getConfigPath());
// version = zk.getLatestVersionFromPath(latestPath);
def = zk.getString(latestPath);
// System.out.printf("\tzkid %x\n", zkid);
return def;
}
use of com.ms.silverking.cloud.zookeeper.ZooKeeperExtended in project SilverKing by Morgan-Stanley.
the class VersionWatcherTest method main.
/**
* @param args
*/
public static void main(String[] args) {
try {
if (args.length < 3) {
System.out.println("<zkConfig> <intervalSeconds> <path...>");
} else {
ZooKeeperConfig zkConfig;
long intervalMillis;
VersionWatcherTest vwTest;
zkConfig = new ZooKeeperConfig(args[0]);
intervalMillis = Integer.parseInt(args[1]) * 1000;
vwTest = new VersionWatcherTest(new ZooKeeperExtended(zkConfig, 2 * 60 * 1000, null));
for (int i = 2; i < args.length; i++) {
vwTest.addWatch(args[i], intervalMillis);
}
Thread.sleep(60 * 60 * 1000);
}
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations