本文整理了Java中kafka.utils.ZkUtils.createZkClientAndConnection()
方法的一些代码示例,展示了ZkUtils.createZkClientAndConnection()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZkUtils.createZkClientAndConnection()
方法的具体详情如下:
包路径:kafka.utils.ZkUtils
类名称:ZkUtils
方法名:createZkClientAndConnection
暂无
代码示例来源:origin: apache/atlas
@VisibleForTesting
protected ZkUtils createZkUtils(Configuration atlasProperties) {
String zkConnect = atlasProperties.getString("atlas.kafka.zookeeper.connect");
int sessionTimeout = atlasProperties.getInt("atlas.kafka.zookeeper.session.timeout.ms", 400);
int connectionTimeout = atlasProperties.getInt("atlas.kafka.zookeeper.connection.timeout.ms", 200);
Tuple2<ZkClient, ZkConnection> zkClientAndConnection = ZkUtils.createZkClientAndConnection(
zkConnect, sessionTimeout, connectionTimeout);
return new ZkUtils(zkClientAndConnection._1(), zkClientAndConnection._2(), false);
}
代码示例来源:origin: pinterest/doctorkafka
public static ZkUtils getZkUtils(String zkUrl) {
if (!zkUtilsMap.containsKey(zkUrl)) {
Tuple2<ZkClient, ZkConnection> zkClientAndConnection =
ZkUtils.createZkClientAndConnection(zkUrl, 30000, 3000000);
ZkUtils zkUtils = new ZkUtils(zkClientAndConnection._1(), zkClientAndConnection._2(), true);
zkUtilsMap.put(zkUrl, zkUtils);
}
return zkUtilsMap.get(zkUrl);
}
代码示例来源:origin: org.apache.atlas/atlas-notification
@VisibleForTesting
protected ZkUtils createZkUtils(Configuration atlasProperties) {
String zkConnect = atlasProperties.getString("atlas.kafka.zookeeper.connect");
int sessionTimeout = atlasProperties.getInt("atlas.kafka.zookeeper.session.timeout.ms", 400);
int connectionTimeout = atlasProperties.getInt("atlas.kafka.zookeeper.connection.timeout.ms", 200);
Tuple2<ZkClient, ZkConnection> zkClientAndConnection = ZkUtils.createZkClientAndConnection(
zkConnect, sessionTimeout, connectionTimeout);
return new ZkUtils(zkClientAndConnection._1(), zkClientAndConnection._2(), false);
}
代码示例来源:origin: pinterest/doctorkafka
public static ZkUtils getZkUtils(String zkUrl) {
if (!zkUtilsMap.containsKey(zkUrl)) {
Tuple2<ZkClient, ZkConnection> zkClientAndConnection =
ZkUtils.createZkClientAndConnection(zkUrl, 30000, 3000000);
ZkUtils zkUtils = new ZkUtils(zkClientAndConnection._1(), zkClientAndConnection._2(), true);
zkUtilsMap.put(zkUrl, zkUtils);
}
return zkUtilsMap.get(zkUrl);
}
代码示例来源:origin: com.github.pinterest/kafkastats
public static ZkUtils getZkUtils(String zkUrl) {
if (!zkUtilsMap.containsKey(zkUrl)) {
Tuple2<ZkClient, ZkConnection> zkClientAndConnection =
ZkUtils.createZkClientAndConnection(zkUrl, 30000, 3000000);
ZkUtils zkUtils = new ZkUtils(zkClientAndConnection._1(), zkClientAndConnection._2(), true);
zkUtilsMap.put(zkUrl, zkUtils);
}
return zkUtilsMap.get(zkUrl);
}
代码示例来源:origin: com.github.pinterest/kafkastats
public static ZkUtils getZkUtils(String zkUrl) {
if (!zkUtilsMap.containsKey(zkUrl)) {
Tuple2<ZkClient, ZkConnection> zkClientAndConnection =
ZkUtils.createZkClientAndConnection(zkUrl, 30000, 3000000);
ZkUtils zkUtils = new ZkUtils(zkClientAndConnection._1(), zkClientAndConnection._2(), true);
zkUtilsMap.put(zkUrl, zkUtils);
}
return zkUtilsMap.get(zkUrl);
}
代码示例来源:origin: com.cerner.common.kafka/common-kafka-admin
private static ZkUtils getZkUtils(Properties properties) {
if (properties == null)
throw new IllegalArgumentException("properties cannot be null");
Tuple2<ZkClient, ZkConnection> tuple;
try {
ZKConfig zkConfig = new ZKConfig(new VerifiableProperties(properties));
tuple = ZkUtils.createZkClientAndConnection(zkConfig.zkConnect(), zkConfig.zkSessionTimeoutMs(),
zkConfig.zkConnectionTimeoutMs());
} catch (ZkException e) {
throw new AdminOperationException("Unable to create admin connection", e);
}
boolean isSecure = Boolean.valueOf(properties.getProperty(ZOOKEEPER_SECURE, DEFAULT_ZOOKEEPER_SECURE));
return new ZkUtils(tuple._1(), tuple._2(), isSecure);
}
内容来源于网络,如有侵权,请联系作者删除!