本文整理了Java中com.github.zkclient.ZkClient.<init>()
方法的一些代码示例,展示了ZkClient.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZkClient.<init>()
方法的具体详情如下:
包路径:com.github.zkclient.ZkClient
类名称:ZkClient
方法名:<init>
[英]Create a client with special implementation
[中]创建具有特殊实现的客户机
代码示例来源:origin: adyliu/jafka
static void tryCleanupZookeeper(String zkConnect, String groupId) {
try {
String dir = "/consumers/" + groupId;
ZkClient zk = new ZkClient(zkConnect, 30 * 1000, 30 * 1000);
zk.deleteRecursive(dir);
zk.close();
} catch (ZkInterruptedException e) {
e.printStackTrace();
}
}
}
代码示例来源:origin: adyliu/jafka
private void connectZk() {
logger.debug("Connecting to zookeeper instance at " + config.getZkConnect());
this.zkClient = new ZkClient(config.getZkConnect(), config.getZkSessionTimeoutMs(),
config.getZkConnectionTimeoutMs());
logger.debug("Connected to zookeeper at " + config.getZkConnect());
}
代码示例来源:origin: adyliu/jafka
public void startup() {
logger.info("connecting to zookeeper: " + config.getZkConnect());
zkClient = new ZkClient(config.getZkConnect(), config.getZkSessionTimeoutMs(),
config.getZkConnectionTimeoutMs());
zkClient.subscribeStateChanges(this);
}
代码示例来源:origin: adyliu/jafka
public ZookeeperTopicEventWatcher(ConsumerConfig consumerConfig, TopicEventHandler<String> eventHandler, ServerStartable serverStartable) {
super();
this.eventHandler = eventHandler;
this.serverStartable = serverStartable;
//
this.zkClient = new ZkClient(consumerConfig.getZkConnect(), //
consumerConfig.getZkSessionTimeoutMs(), //
consumerConfig.getZkConnectionTimeoutMs());
startWatchingTopicEvents();
}
代码示例来源:origin: adyliu/jafka
public ZKBrokerPartitionInfo(ZKConfig zkConfig, Callback callback) {
this.zkConfig = zkConfig;
this.callback = callback;
//
this.zkClient = new ZkClient(zkConfig.getZkConnect(), //
zkConfig.getZkSessionTimeoutMs(), //
zkConfig.getZkConnectionTimeoutMs());
//
this.allBrokers = getZKBrokerInfo();
this.topicBrokerPartitions = getZKTopicPartitionInfo(this.allBrokers);
//use just the brokerTopicsListener for all watchers
this.brokerTopicsListener = new BrokerTopicsListener(this.topicBrokerPartitions, this.allBrokers);
//register listener for change of topics to keep topicsBrokerPartitions updated
zkClient.subscribeChildChanges(ZkUtils.BrokerTopicsPath, brokerTopicsListener);
//register listener for change of brokers for each topic to keep topicsBrokerPartitions updated
for (String topic : this.topicBrokerPartitions.keySet()) {
zkClient.subscribeChildChanges(ZkUtils.BrokerTopicsPath + "/" + topic, this.brokerTopicsListener);
}
// register listener for new broker
zkClient.subscribeChildChanges(ZkUtils.BrokerIdsPath, this.brokerTopicsListener);
//
// register listener for session expired event
zkClient.subscribeStateChanges(new ZKSessionExpirationListener());
}
代码示例来源:origin: com.github.adyliu/zkclient
@PostConstruct
public void start() {
startZkServer();
_zkClient = new ZkClient("localhost:" + _port, 10000);
}
代码示例来源:origin: adyliu/zkclient
@PostConstruct
public void start() {
startZkServer();
_zkClient = new ZkClient("localhost:" + _port, 10000);
}
内容来源于网络,如有侵权,请联系作者删除!