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

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

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

ZKRMStateStore.getChildrenWithRetries介绍

暂无

代码示例

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

private void loadRMDelegationKeyState(RMState rmState) throws Exception {
 List<String> childNodes =
   getChildrenWithRetries(dtMasterKeysRootPath, false);
 for (String childNodeName : childNodes) {
  String childNodePath = getNodePath(dtMasterKeysRootPath, childNodeName);
  byte[] childData = getDataWithRetries(childNodePath, false);
  if (childData == null) {
   LOG.warn("Content of " + childNodePath + " is broken.");
   continue;
  }
  ByteArrayInputStream is = new ByteArrayInputStream(childData);
  DataInputStream fsIn = new DataInputStream(is);
  try {
   if (childNodeName.startsWith(DELEGATION_KEY_PREFIX)) {
    DelegationKey key = new DelegationKey();
    key.readFields(fsIn);
    rmState.rmSecretManagerState.masterKeyState.add(key);
    if (LOG.isDebugEnabled()) {
     LOG.debug("Loaded delegation key: keyId=" + key.getKeyId()
       + ", expirationDate=" + key.getExpiryDate());
    }
   }
  } finally {
   is.close();
  }
 }
}

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

private void loadRMDelegationKeyState(RMState rmState) throws Exception {
 List<String> childNodes =
   getChildrenWithRetries(dtMasterKeysRootPath, false);
 for (String childNodeName : childNodes) {
  String childNodePath = getNodePath(dtMasterKeysRootPath, childNodeName);
  byte[] childData = getDataWithRetries(childNodePath, false);
  if (childData == null) {
   LOG.warn("Content of " + childNodePath + " is broken.");
   continue;
  }
  ByteArrayInputStream is = new ByteArrayInputStream(childData);
  DataInputStream fsIn = new DataInputStream(is);
  try {
   if (childNodeName.startsWith(DELEGATION_KEY_PREFIX)) {
    DelegationKey key = new DelegationKey();
    key.readFields(fsIn);
    rmState.rmSecretManagerState.masterKeyState.add(key);
    if (LOG.isDebugEnabled()) {
     LOG.debug("Loaded delegation key: keyId=" + key.getKeyId()
       + ", expirationDate=" + key.getExpiryDate());
    }
   }
  } finally {
   is.close();
  }
 }
}

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

private void loadRMDelegationTokenState(RMState rmState) throws Exception {
 List<String> childNodes =
   getChildrenWithRetries(delegationTokensRootPath, false);
 for (String childNodeName : childNodes) {
  String childNodePath =

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

private void loadRMDelegationTokenState(RMState rmState) throws Exception {
 List<String> childNodes =
   getChildrenWithRetries(delegationTokensRootPath, false);
 for (String childNodeName : childNodes) {
  String childNodePath =

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

private void loadApplicationAttemptState(ApplicationStateData appState,
  ApplicationId appId)
  throws Exception {
 String appPath = getNodePath(rmAppRoot, appId.toString());
 List<String> attempts = getChildrenWithRetries(appPath, false);
 for (String attemptIDStr : attempts) {
  if (attemptIDStr.startsWith(ApplicationAttemptId.appAttemptIdStrPrefix)) {
   String attemptPath = getNodePath(appPath, attemptIDStr);
   byte[] attemptData = getDataWithRetries(attemptPath, false);
   ApplicationAttemptStateDataPBImpl attemptState =
     new ApplicationAttemptStateDataPBImpl(
       ApplicationAttemptStateDataProto.parseFrom(attemptData));
   appState.attempts.put(attemptState.getAttemptId(), attemptState);
  }
 }
 LOG.debug("Done loading applications from ZK state store");
}

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

private void loadApplicationAttemptState(ApplicationStateData appState,
  ApplicationId appId)
  throws Exception {
 String appPath = getNodePath(rmAppRoot, appId.toString());
 List<String> attempts = getChildrenWithRetries(appPath, false);
 for (String attemptIDStr : attempts) {
  if (attemptIDStr.startsWith(ApplicationAttemptId.appAttemptIdStrPrefix)) {
   String attemptPath = getNodePath(appPath, attemptIDStr);
   byte[] attemptData = getDataWithRetries(attemptPath, false);
   ApplicationAttemptStateDataPBImpl attemptState =
     new ApplicationAttemptStateDataPBImpl(
       ApplicationAttemptStateDataProto.parseFrom(attemptData));
   appState.attempts.put(attemptState.getAttemptId(), attemptState);
  }
 }
 LOG.debug("Done loading applications from ZK state store");
}

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

private synchronized void loadRMAppState(RMState rmState) throws Exception {
 List<String> childNodes = getChildrenWithRetries(rmAppRoot, false);
 for (String childNodeName : childNodes) {
  String childNodePath = getNodePath(rmAppRoot, childNodeName);
  byte[] childData = getDataWithRetries(childNodePath, false);
  if (childNodeName.startsWith(ApplicationId.appIdStrPrefix)) {
   // application
   if (LOG.isDebugEnabled()) {
    LOG.debug("Loading application from znode: " + childNodeName);
   }
   ApplicationId appId = ConverterUtils.toApplicationId(childNodeName);
   ApplicationStateDataPBImpl appState =
     new ApplicationStateDataPBImpl(
       ApplicationStateDataProto.parseFrom(childData));
   if (!appId.equals(
     appState.getApplicationSubmissionContext().getApplicationId())) {
    throw new YarnRuntimeException("The child node name is different " +
      "from the application id");
   }
   rmState.appState.put(appId, appState);
   loadApplicationAttemptState(appState, appId);
  } else {
   LOG.info("Unknown child node with name: " + childNodeName);
  }
 }
}

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

private synchronized void loadRMAppState(RMState rmState) throws Exception {
 List<String> childNodes = getChildrenWithRetries(rmAppRoot, false);
 for (String childNodeName : childNodes) {
  String childNodePath = getNodePath(rmAppRoot, childNodeName);
  byte[] childData = getDataWithRetries(childNodePath, false);
  if (childNodeName.startsWith(ApplicationId.appIdStrPrefix)) {
   // application
   if (LOG.isDebugEnabled()) {
    LOG.debug("Loading application from znode: " + childNodeName);
   }
   ApplicationId appId = ConverterUtils.toApplicationId(childNodeName);
   ApplicationStateDataPBImpl appState =
     new ApplicationStateDataPBImpl(
       ApplicationStateDataProto.parseFrom(childData));
   if (!appId.equals(
     appState.getApplicationSubmissionContext().getApplicationId())) {
    throw new YarnRuntimeException("The child node name is different " +
      "from the application id");
   }
   rmState.appState.put(appId, appState);
   loadApplicationAttemptState(appState, appId);
  } else {
   LOG.info("Unknown child node with name: " + childNodeName);
  }
 }
}

相关文章

微信公众号

最新文章

更多