- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中com.alibaba.wasp.zookeeper.ZooKeeperWatcher.getMasterAddressZNode()
方法的一些代码示例,展示了ZooKeeperWatcher.getMasterAddressZNode()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeperWatcher.getMasterAddressZNode()
方法的具体详情如下:
包路径:com.alibaba.wasp.zookeeper.ZooKeeperWatcher
类名称:ZooKeeperWatcher
方法名:getMasterAddressZNode
暂无
代码示例来源:origin: alibaba/wasp
/**
* Construct a master address listener with the specified
* <code>zookeeper</code> reference.
* <p>
* This constructor does not trigger any actions, you must call methods
* explicitly. Normally you will just want to execute {@link #start()} to
* begin tracking of the master address.
*
* @param watcher
* zk reference and watcher
* @param abortable
* abortable in case of fatal error
*/
public MasterAddressTracker(ZooKeeperWatcher watcher, Abortable abortable) {
super(watcher, watcher.getMasterAddressZNode(), abortable);
}
代码示例来源:origin: alibaba/wasp
/**
* @return True if cluster has an active master.
*/
public boolean isActiveMaster() {
try {
if (ZKUtil.checkExists(watcher, watcher.getMasterAddressZNode()) >= 0) {
return true;
}
}
catch (KeeperException ke) {
LOG.info("Received an unexpected KeeperException when checking "
+ "isActiveMaster : " + ke);
}
return false;
}
代码示例来源:origin: alibaba/wasp
private static ArrayList<ACL> createACL(ZooKeeperWatcher zkw, String node) {
if (isSecureZooKeeper(zkw.getConfiguration())) {
// Certain znodes are accessed directly by the client,
// so they must be readable by non-authenticated clients
if ((node.equals(zkw.baseZNode) == true)
|| (node.equals(zkw.getMasterAddressZNode()) == true)
|| (node.equals(zkw.clusterIdZNode) == true)
|| (node.equals(zkw.fsZNode) == true)
|| (node.equals(zkw.backupMasterAddressesZNode) == true)
|| (node.startsWith(zkw.tableZNode) == true)) {
return ZooKeeperWatcher.CREATOR_ALL_AND_WORLD_READABLE;
}
return Ids.CREATOR_ALL_ACL;
} else {
return Ids.OPEN_ACL_UNSAFE;
}
}
代码示例来源:origin: alibaba/wasp
void handle(final String path) {
if (path.equals(watcher.getMasterAddressZNode()) && !master.isStopped()) {
handleMasterNodeChange();
}
}
代码示例来源:origin: alibaba/wasp
synchronized (clusterHasActiveMaster) {
if (ZKUtil
.watchAndCheckExists(watcher, watcher.getMasterAddressZNode())) {
代码示例来源:origin: alibaba/wasp
/**
* delete the master znode if its content is same as the parameter
*/
public static boolean deleteIfEquals(ZooKeeperWatcher zkw,
final String content) {
if (content == null) {
throw new IllegalArgumentException("Content must not be null");
}
try {
Stat stat = new Stat();
byte[] data = ZKUtil.getDataNoWatch(zkw, zkw.getMasterAddressZNode(),
stat);
ServerName sn = ServerName.parseFrom(data);
if (sn != null && content.equals(sn.toString())) {
return (ZKUtil.deleteNode(zkw, zkw.getMasterAddressZNode(),
stat.getVersion()));
}
} catch (KeeperException e) {
LOG.warn("Can't get or delete the master znode", e);
} catch (DeserializationException e) {
LOG.warn("Can't get or delete the master znode", e);
}
return false;
}
}
代码示例来源:origin: alibaba/wasp
public void stop() {
try {
// If our address is in ZK, delete it on our way out
ServerName activeMaster = null;
try {
activeMaster = MasterAddressTracker.getMasterAddress(this.watcher);
} catch (IOException e) {
LOG.warn("Failed get of master address: " + e.toString());
}
if (activeMaster != null && activeMaster.equals(this.sn)) {
ZKUtil.deleteNode(watcher, watcher.getMasterAddressZNode());
// We may have failed to delete the znode at the previous step, but
// we delete the file anyway: a second attempt to delete the znode is
// likely to fail again.
ZNodeClearer.deleteMyEphemeralNodeOnDisk();
}
} catch (KeeperException e) {
LOG.error(
this.watcher.prefix("Error deleting our own master address node"), e);
}
}
}
代码示例来源:origin: alibaba/wasp
/**
* Get master address. Use this instead of {@link #getMasterAddress()} if you
* do not have an instance of this tracker in your context.
*
* @param zkw
* ZooKeeperWatcher to use
* @return ServerName stored in the the master address znode or null if no
* znode present.
* @throws org.apache.zookeeper.KeeperException
* @throws java.io.IOException
*/
public static ServerName getMasterAddress(final ZooKeeperWatcher zkw)
throws KeeperException, IOException {
byte[] data = ZKUtil.getData(zkw, zkw.getMasterAddressZNode());
if (data == null) {
throw new IOException(
"Can't get master address from ZooKeeper; znode data == null");
}
try {
return ServerName.parseFrom(data);
} catch (DeserializationException e) {
KeeperException ke = new KeeperException.DataInconsistencyException();
ke.initCause(e);
throw ke;
}
}
代码示例来源:origin: alibaba/wasp
this.watcher.backupMasterAddressesZNode, this.sn.toString());
if (MasterAddressTracker.setMasterAddress(this.watcher,
this.watcher.getMasterAddressZNode(), this.sn)) {
this.watcher.getMasterAddressZNode());
if (bytes == null) {
msg = ("A master was detected, but went down before its address "
this.watcher.getMasterAddressZNode());
代码示例来源:origin: alibaba/wasp
"testActiveMasterManagerFromZK", null, true);
try {
ZKUtil.deleteNode(zk, zk.getMasterAddressZNode());
ZKUtil.deleteNode(zk, zk.clusterStateZNode);
} catch (KeeperException.NoNodeException nne) {
zk.getMasterAddressZNode());
zk.registerListener(listener);
ZKUtil.deleteNode(zk, zk.getMasterAddressZNode());
ZKUtil.deleteNode(zk, zk.getMasterAddressZNode());
代码示例来源:origin: alibaba/wasp
"testActiveMasterManagerFromZK", null, true);
try {
ZKUtil.deleteNode(zk, zk.getMasterAddressZNode());
ZKUtil.deleteNode(zk, zk.clusterStateZNode);
} catch (KeeperException.NoNodeException nne) {
本文整理了Java中com.alibaba.wasp.zookeeper.ZooKeeperWatcher.getMasterAddressZNode()方法的一些代码示例,展示了ZooKeeperW
本文整理了Java中org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.getMasterAddressZNode()方法的一些代码示例,展示了Zoo
我是一名优秀的程序员,十分优秀!