org.apache.zookeeper.ZooKeeper.getClientConfig()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(252)

本文整理了Java中org.apache.zookeeper.ZooKeeper.getClientConfig()方法的一些代码示例,展示了ZooKeeper.getClientConfig()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeper.getClientConfig()方法的具体详情如下:
包路径:org.apache.zookeeper.ZooKeeper
类名称:ZooKeeper
方法名:getClientConfig

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);

相关文章