コード例 #1
0
 @Override
 public void processChildNode(String appDirName, String childNodeName, byte[] childData)
     throws com.google.protobuf.InvalidProtocolBufferException {
   if (childNodeName.startsWith(ApplicationId.appIdStrPrefix)) {
     // application
     if (LOG.isDebugEnabled()) {
       LOG.debug("Loading application from node: " + childNodeName);
     }
     ApplicationStateDataPBImpl appState =
         new ApplicationStateDataPBImpl(ApplicationStateDataProto.parseFrom(childData));
     ApplicationId appId = appState.getApplicationSubmissionContext().getApplicationId();
     rmState.appState.put(appId, appState);
   } else if (childNodeName.startsWith(ApplicationAttemptId.appAttemptIdStrPrefix)) {
     // attempt
     if (LOG.isDebugEnabled()) {
       LOG.debug("Loading application attempt from node: " + childNodeName);
     }
     ApplicationAttemptStateDataPBImpl attemptState =
         new ApplicationAttemptStateDataPBImpl(
             ApplicationAttemptStateDataProto.parseFrom(childData));
     attempts.add(attemptState);
   } else {
     LOG.info("Unknown child node with name: " + childNodeName);
   }
 }
コード例 #2
0
 private ApplicationAttemptStateData createAttemptState(String itemName, byte[] data)
     throws IOException {
   ApplicationAttemptId attemptId = ConverterUtils.toApplicationAttemptId(itemName);
   ApplicationAttemptStateDataPBImpl attemptState =
       new ApplicationAttemptStateDataPBImpl(ApplicationAttemptStateDataProto.parseFrom(data));
   if (!attemptId.equals(attemptState.getAttemptId())) {
     throw new YarnRuntimeException(
         "The database entry for "
             + attemptId
             + " contains data for "
             + attemptState.getAttemptId());
   }
   return attemptState;
 }