- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中com.twitter.common.zookeeper.ZooKeeperUtils.ensurePath()
方法的一些代码示例,展示了ZooKeeperUtils.ensurePath()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeperUtils.ensurePath()
方法的具体详情如下:
包路径:com.twitter.common.zookeeper.ZooKeeperUtils
类名称:ZooKeeperUtils
方法名:ensurePath
[英]Ensures the given path exists in the ZK cluster accessed by zkClient. If the path already exists, nothing is done; however if any portion of the path is missing, it will be created with the given acl as a persistent zookeeper node. The given path must be a valid zookeeper absolute path.
[中]确保给定路径存在于ZK客户端访问的ZK集群中。如果路径已经存在,则什么也不做;但是,如果路径的任何部分丢失,将使用给定的acl作为持久的zookeeper节点创建该路径。给定路径必须是有效的zookeeper绝对路径。
代码示例来源:origin: com.twitter.common/zookeeper
private synchronized void prepare()
throws ZooKeeperClient.ZooKeeperConnectionException, InterruptedException, KeeperException {
ZooKeeperUtils.ensurePath(zkClient, acl, lockPath);
LOG.log(Level.FINE, "Working with locking path:" + lockPath);
// Create an EPHEMERAL_SEQUENTIAL node.
currentNode =
zkClient.get().create(lockPath + "/member_", null, acl, CreateMode.EPHEMERAL_SEQUENTIAL);
// We only care about our actual id since we want to compare ourselves to siblings.
if (currentNode.contains("/")) {
currentId = currentNode.substring(currentNode.lastIndexOf("/") + 1);
}
LOG.log(Level.FINE, "Received ID from zk:" + currentId);
this.watcher = new LockWatcher();
}
代码示例来源:origin: com.twitter.common.zookeeper/lock
private synchronized void prepare()
throws ZooKeeperClient.ZooKeeperConnectionException, InterruptedException, KeeperException {
ZooKeeperUtils.ensurePath(zkClient, acl, lockPath);
LOG.log(Level.FINE, "Working with locking path:" + lockPath);
// Create an EPHEMERAL_SEQUENTIAL node.
currentNode =
zkClient.get().create(lockPath + "/member_", null, acl, CreateMode.EPHEMERAL_SEQUENTIAL);
// We only care about our actual id since we want to compare ourselves to siblings.
if (currentNode.contains("/")) {
currentId = currentNode.substring(currentNode.lastIndexOf("/") + 1);
}
LOG.log(Level.FINE, "Received ID from zk:" + currentId);
this.watcher = new LockWatcher();
}
代码示例来源:origin: com.twitter.common.zookeeper/group
@Override public Boolean get() throws JoinException {
try {
ZooKeeperUtils.ensurePath(zkClient, acl, path);
return true;
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new JoinException("Interrupted trying to ensure group at path: " + path, e);
} catch (ZooKeeperConnectionException e) {
LOG.log(Level.WARNING, "Problem connecting to ZooKeeper, retrying", e);
return false;
} catch (KeeperException e) {
if (zkClient.shouldRetry(e)) {
LOG.log(Level.WARNING, "Temporary error ensuring path: " + path, e);
return false;
} else {
throw new JoinException("Problem ensuring group at path: " + path, e);
}
}
}
});
代码示例来源:origin: com.twitter.common/zookeeper
@Override public Boolean get() throws JoinException {
try {
ZooKeeperUtils.ensurePath(zkClient, acl, path);
return true;
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new JoinException("Interrupted trying to ensure group at path: " + path, e);
} catch (ZooKeeperConnectionException e) {
LOG.log(Level.WARNING, "Problem connecting to ZooKeeper, retrying", e);
return false;
} catch (KeeperException e) {
if (zkClient.shouldRetry(e)) {
LOG.log(Level.WARNING, "Temporary error ensuring path: " + path, e);
return false;
} else {
throw new JoinException("Problem ensuring group at path: " + path, e);
}
}
}
});
本文整理了Java中com.twitter.common.zookeeper.ZooKeeperUtils.ensurePath()方法的一些代码示例,展示了ZooKeeperUtils.ensure
本文整理了Java中org.apache.hadoop.hive.thrift.ZooKeeperTokenStore.ensurePath()方法的一些代码示例,展示了ZooKeeperTokenS
本文整理了Java中com.spotify.helios.servicescommon.coordination.ZooKeeperClient.ensurePath()方法的一些代码示例,展示了Zo
我是一名优秀的程序员,十分优秀!