本文整理了Java中org.apache.zookeeper.ZooKeeper.getClientConfig()
方法的一些代码示例,展示了ZooKeeper.getClientConfig()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeper.getClientConfig()
方法的具体详情如下:
包路径:org.apache.zookeeper.ZooKeeper
类名称:ZooKeeper
方法名:getClientConfig
暂无
代码示例来源:origin: apache/zookeeper
private ClientCnxnSocket getClientCnxnSocket() throws IOException {
String clientCnxnSocketName = getClientConfig().getProperty(
ZKClientConfig.ZOOKEEPER_CLIENT_CNXN_SOCKET);
if (clientCnxnSocketName == null) {
clientCnxnSocketName = ClientCnxnSocketNIO.class.getName();
}
try {
Constructor<?> clientCxnConstructor = Class.forName(clientCnxnSocketName).getDeclaredConstructor(ZKClientConfig.class);
ClientCnxnSocket clientCxnSocket = (ClientCnxnSocket) clientCxnConstructor.newInstance(getClientConfig());
return clientCxnSocket;
} catch (Exception e) {
IOException ioe = new IOException("Couldn't instantiate "
+ clientCnxnSocketName);
ioe.initCause(e);
throw ioe;
}
}
代码示例来源:origin: apache/zookeeper
protected ZKWatchManager defaultWatchManager() {
return new ZKWatchManager(getClientConfig().getBoolean(ZKClientConfig.DISABLE_AUTO_WATCH_RESET));
}
代码示例来源:origin: apache/zookeeper
this.clientConfig=zooKeeper.getClientConfig();
initRequestTimeout();
代码示例来源:origin: apache/zookeeper
@Test
public void testClientReconnect() throws IOException, InterruptedException {
HostProvider hostProvider = mock(HostProvider.class);
when(hostProvider.size()).thenReturn(1);
InetSocketAddress inaddr = new InetSocketAddress("127.0.0.1", 1111);
when(hostProvider.next(anyLong())).thenReturn(inaddr);
ZooKeeper zk = mock(ZooKeeper.class);
when(zk.getClientConfig()).thenReturn(new ZKClientConfig());
sc = SocketChannel.open();
ClientCnxnSocketNIO nioCnxn = new MockCnxn();
ClientWatchManager watcher = mock(ClientWatchManager.class);
ClientCnxn clientCnxn = new ClientCnxn(
"tmp", hostProvider, 5000,
zk, watcher, nioCnxn, false);
clientCnxn.start();
countDownLatch.await(5000, TimeUnit.MILLISECONDS);
Assert.assertTrue(countDownLatch.getCount() == 0);
clientCnxn.close();
}
}
代码示例来源:origin: apache/zookeeper
startServer();
globalWatcher.waitForConnected(3000);
boolean disableAutoWatchReset = zk.getClientConfig().getBoolean(ZKClientConfig.DISABLE_AUTO_WATCH_RESET);
if (!isGlobal && !disableAutoWatchReset) {
localWatcher.waitForConnected(500);
内容来源于网络,如有侵权,请联系作者删除!