本文整理了Java中org.fusesource.fabric.zookeeper.utils.ZooKeeperUtils
类的一些代码示例,展示了ZooKeeperUtils
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeperUtils
类的具体详情如下:
包路径:org.fusesource.fabric.zookeeper.utils.ZooKeeperUtils
类名称:ZooKeeperUtils
暂无
代码示例来源:origin: org.fusesource.fabric/fabric-commands
/**
* Saves content to the specified location.
*
* @param content
* @param location
* @return
*/
@Override
public boolean save(String content, String location) {
try {
ZooKeeperUtils.set(zookeeper,location, content);
} catch (Exception e) {
return false;
}
return true;
}
代码示例来源:origin: org.fusesource.fabric/fabric-configadmin
try {
if (!tracking) {
String version = ZooKeeperUtils.get(zooKeeper, ZkPath.CONFIG_CONTAINER.getPath(name));
if (ZooKeeperUtils.exists(zooKeeper, ZkPath.CONTAINER_IP.getPath(name)) != null) {
String resolutionPointer = ZooKeeperUtils.get(zooKeeper, ZkPath.CONTAINER_IP.getPath(name));
resolutionPolicy = ZooKeeperUtils.get(zooKeeper, ZkPath.CONTAINER_RESOLVER.getPath(name));
if (resolutionPointer == null || !resolutionPointer.contains(resolutionPolicy)) {
ZooKeeperUtils.set(zooKeeper, ZkPath.CONTAINER_IP.getPath(name), "${zk:" + name + "/" + resolutionPolicy + "}");
System.setProperty(SystemProperties.JAVA_RMI_SERVER_HOSTNAME, ZooKeeperUtils.getSubstitutedData(zooKeeper, ZooKeeperUtils.get(zooKeeper, ZkPath.CONTAINER_IP.getPath(name))));
代码示例来源:origin: org.fusesource.fabric/fabric-configadmin
if (ZooKeeperUtils.exists(zooKeeper, versionNode) == null) {
ZkPath.createContainerPaths(zooKeeper, name, null, "fabric");
version = ZooKeeperUtils.get(zooKeeper, versionNode);
if (version == null) {
throw new IllegalStateException("Configuration for node " + name + " not found at " + ZkPath.CONFIG_CONTAINER.getPath(name));
if (ZooKeeperUtils.exists(zooKeeper, node) == null) {
ZooKeeperUtils.create(zooKeeper, node);
if (ZooKeeperUtils.exists(zooKeeper, ensemble) == null) {
ZooKeeperUtils.create(zooKeeper, ensemble);
代码示例来源:origin: org.fusesource.fabric/fabric-commands
if (!services.isEmpty()) {
for (Object service : services) {
node.services.add(ZooKeeperUtils.getSubstitutedData(getZooKeeper(), service.toString()));
代码示例来源:origin: org.fusesource.fabric/fabric-jaas
try {
zookeeper = (IZKClient) bundleContext.getService(serviceReference);
users = ZooKeeperUtils.getProperties(zookeeper, ZookeeperBackingEngine.USERS_NODE);
} catch (Exception e) {
LOG.warn("Failed fetching authentication data.", e);
users = ZooKeeperUtils.getProperties(zookeeper, ZookeeperBackingEngine.USERS_NODE);
} catch (Exception e) {
LOG.warn("Failed fetching authentication data.", e);
代码示例来源:origin: org.fusesource.fabric/fabric-configadmin
protected ZooKeeperTreeTracker<String> track(String path) throws InterruptedException, KeeperException, IOException {
ZooKeeperTreeTracker<String> tree = trees.get(path);
if (tree == null) {
if (ZooKeeperUtils.exists(zooKeeper, path) != null) {
tree = new ZooKeeperTreeTracker<String>(zooKeeper, new ZKStringDataReader(), path);
trees.put(path, tree);
tree.track(this);
String[] parents = getParents(tree.getTree().get(path));
for (String parent : parents) {
track(ZkPath.CONFIG_VERSIONS_PROFILE.getPath(version, parent));
}
} else {
// If the node does not exist yet, we track the parent to make
// sure we receive the node creation event
String p = ZkPath.CONFIG_VERSIONS_PROFILES.getPath(version);
if (!trees.containsKey(p)) {
tree = new ZooKeeperTreeTracker<String>(zooKeeper, new ZKStringDataReader(), p, 1);
trees.put(p, tree);
tree.track(this);
}
return null;
}
}
return tree;
}
内容来源于网络,如有侵权,请联系作者删除!