- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中com.krpc.common.entity.ZookeeperInfo
类的一些代码示例,展示了ZookeeperInfo
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZookeeperInfo
类的具体详情如下:
包路径:com.krpc.common.entity.ZookeeperInfo
类名称:ZookeeperInfo
暂无
代码示例来源:origin: yangzhenkun/krpc
public static void init(ZookeeperInfo zookeeperInfo) {
if (zc != null) {
return;
}
try {
zc = new ZkClient(zookeeperInfo.getAddr(), zookeeperInfo.getSessionTimeOut(), zookeeperInfo.getConnectionTimeOut());
} catch (Exception e) {
e.printStackTrace();
log.error("zk init error!", e);
}
}
代码示例来源:origin: yangzhenkun/krpc
public static ZookeeperInfo createByElement(Element root) {
/**
* 初始化注册中心数据
*/
ZookeeperInfo zookeeperInfo = null;
try {
Element zkNode = root.element("zk");
if (zkNode != null) {
String sessionTimeStr = zkNode.attributeValue("sessionTimeOut");
String connectionTimeOutStr = zkNode.attributeValue("connectionTimeOut");
Element addrNode = zkNode.element("addr");
String addr = addrNode.getData().toString();
zookeeperInfo = new ZookeeperInfo(addr, Integer.valueOf(sessionTimeStr), Integer.valueOf(connectionTimeOutStr));
}
} catch (Exception e) {
log.error("get zk info from server.xml error!",e);
} finally {
return zookeeperInfo;
}
}
代码示例来源:origin: yangzhenkun/krpc
ZookeeperInfo zookeeperInfo = ZookeeperInfo.createByElement(root);
if (zookeeperInfo != null) {
ZkRegisterCenter.init(zookeeperInfo);
代码示例来源:origin: yangzhenkun/krpc
Global.getInstance().setZookeeperInfo(ZookeeperInfo.createByElement(node));
代码示例来源:origin: yangzhenkun/krpc
public static void register() {
try {
ZookeeperInfo zookeeperInfo = Global.getInstance().getZookeeperInfo();
zc = new ZkClient(zookeeperInfo.getAddr(), zookeeperInfo.getSessionTimeOut(), zookeeperInfo.getConnectionTimeOut());
StringBuffer stringBuffer = new StringBuffer("/krpc");
if (!zc.exists(stringBuffer.toString())) {
zc.create(stringBuffer.toString(), "", CreateMode.PERSISTENT);
log.info("创建根节点krpc");
}
stringBuffer.append("/").append(Global.getInstance().getServiceName());
if (!zc.exists(stringBuffer.toString())) {
zc.create(stringBuffer.toString(), "", CreateMode.PERSISTENT);
log.info("创建{}服务节点", Global.getInstance().getServiceName());
}
stringBuffer.append("/").append(Global.getInstance().getIp()).append(":").append(Global.getInstance().getPort());
zc.create(stringBuffer.toString(), Global.getInstance().getServiceName(), CreateMode.EPHEMERAL);
} catch (Exception e) {
log.error("register error!", e);
}
}
本文整理了Java中com.krpc.common.entity.ZookeeperInfo.getSessionTimeOut()方法的一些代码示例,展示了ZookeeperInfo.getSess
本文整理了Java中com.krpc.common.entity.ZookeeperInfo.getAddr()方法的一些代码示例,展示了ZookeeperInfo.getAddr()的具体用法。这些
本文整理了Java中com.krpc.common.entity.ZookeeperInfo.getConnectionTimeOut()方法的一些代码示例,展示了ZookeeperInfo.getC
本文整理了Java中com.krpc.common.entity.ZookeeperInfo.createByElement()方法的一些代码示例,展示了ZookeeperInfo.createByE
我是一名优秀的程序员,十分优秀!