org.apache.hadoop.yarn.server.resourcemanager.recovery.ZKRMStateStore.getNewZooKeeper()方法的使用及代码示例

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

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

ZKRMStateStore.getNewZooKeeper介绍

暂无

代码示例

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

private synchronized void createConnection()
  throws IOException, InterruptedException {
 closeZkClients();
 for (int retries = 0; retries < numRetries && zkClient == null;
   retries++) {
  try {
   activeZkClient = getNewZooKeeper();
   zkClient = activeZkClient;
   for (ZKUtil.ZKAuthInfo zkAuth : zkAuths) {
    zkClient.addAuthInfo(zkAuth.getScheme(), zkAuth.getAuth());
   }
   if (useDefaultFencingScheme) {
    zkClient.addAuthInfo(zkRootNodeAuthScheme,
      (zkRootNodeUsername + ":" + zkRootNodePassword).getBytes(Charset.forName("UTF-8")));
   }
  } catch (IOException ioe) {
   // Retry in case of network failures
   LOG.info("Failed to connect to the ZooKeeper on attempt - " +
     (retries + 1));
   ioe.printStackTrace();
  }
 }
 if (zkClient == null) {
  LOG.error("Unable to connect to Zookeeper");
  throw new YarnRuntimeException("Unable to connect to Zookeeper");
 }
 ZKRMStateStore.this.notifyAll();
 LOG.info("Created new ZK connection");
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-server-resourcemanager

private synchronized void createConnection()
  throws IOException, InterruptedException {
 closeZkClients();
 for (int retries = 0; retries < numRetries && zkClient == null;
   retries++) {
  try {
   activeZkClient = getNewZooKeeper();
   zkClient = activeZkClient;
   for (ZKUtil.ZKAuthInfo zkAuth : zkAuths) {
    zkClient.addAuthInfo(zkAuth.getScheme(), zkAuth.getAuth());
   }
   if (useDefaultFencingScheme) {
    zkClient.addAuthInfo(zkRootNodeAuthScheme,
      (zkRootNodeUsername + ":" + zkRootNodePassword).getBytes(Charset.forName("UTF-8")));
   }
  } catch (IOException ioe) {
   // Retry in case of network failures
   LOG.info("Failed to connect to the ZooKeeper on attempt - " +
     (retries + 1));
   ioe.printStackTrace();
  }
 }
 if (zkClient == null) {
  LOG.error("Unable to connect to Zookeeper");
  throw new YarnRuntimeException("Unable to connect to Zookeeper");
 }
 ZKRMStateStore.this.notifyAll();
 LOG.info("Created new ZK connection");
}

相关文章

微信公众号

最新文章

更多