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

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

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

ZooKeeper.getClientConfig介绍

暂无

代码示例

代码示例来源:origin: apache/zookeeper

  1. private ClientCnxnSocket getClientCnxnSocket() throws IOException {
  2. String clientCnxnSocketName = getClientConfig().getProperty(
  3. ZKClientConfig.ZOOKEEPER_CLIENT_CNXN_SOCKET);
  4. if (clientCnxnSocketName == null) {
  5. clientCnxnSocketName = ClientCnxnSocketNIO.class.getName();
  6. }
  7. try {
  8. Constructor<?> clientCxnConstructor = Class.forName(clientCnxnSocketName).getDeclaredConstructor(ZKClientConfig.class);
  9. ClientCnxnSocket clientCxnSocket = (ClientCnxnSocket) clientCxnConstructor.newInstance(getClientConfig());
  10. return clientCxnSocket;
  11. } catch (Exception e) {
  12. IOException ioe = new IOException("Couldn't instantiate "
  13. + clientCnxnSocketName);
  14. ioe.initCause(e);
  15. throw ioe;
  16. }
  17. }

代码示例来源:origin: apache/zookeeper

  1. protected ZKWatchManager defaultWatchManager() {
  2. return new ZKWatchManager(getClientConfig().getBoolean(ZKClientConfig.DISABLE_AUTO_WATCH_RESET));
  3. }

代码示例来源:origin: apache/zookeeper

  1. this.clientConfig=zooKeeper.getClientConfig();
  2. initRequestTimeout();

代码示例来源:origin: apache/zookeeper

  1. @Test
  2. public void testClientReconnect() throws IOException, InterruptedException {
  3. HostProvider hostProvider = mock(HostProvider.class);
  4. when(hostProvider.size()).thenReturn(1);
  5. InetSocketAddress inaddr = new InetSocketAddress("127.0.0.1", 1111);
  6. when(hostProvider.next(anyLong())).thenReturn(inaddr);
  7. ZooKeeper zk = mock(ZooKeeper.class);
  8. when(zk.getClientConfig()).thenReturn(new ZKClientConfig());
  9. sc = SocketChannel.open();
  10. ClientCnxnSocketNIO nioCnxn = new MockCnxn();
  11. ClientWatchManager watcher = mock(ClientWatchManager.class);
  12. ClientCnxn clientCnxn = new ClientCnxn(
  13. "tmp", hostProvider, 5000,
  14. zk, watcher, nioCnxn, false);
  15. clientCnxn.start();
  16. countDownLatch.await(5000, TimeUnit.MILLISECONDS);
  17. Assert.assertTrue(countDownLatch.getCount() == 0);
  18. clientCnxn.close();
  19. }
  20. }

代码示例来源:origin: apache/zookeeper

  1. startServer();
  2. globalWatcher.waitForConnected(3000);
  3. boolean disableAutoWatchReset = zk.getClientConfig().getBoolean(ZKClientConfig.DISABLE_AUTO_WATCH_RESET);
  4. if (!isGlobal && !disableAutoWatchReset) {
  5. localWatcher.waitForConnected(500);

相关文章