コード例 #1
0
 @Override
 public void storeOrUpdateAMRMTokenSecretManagerState(
     AMRMTokenSecretManagerState state, boolean isUpdate) {
   AMRMTokenSecretManagerState data = AMRMTokenSecretManagerState.newInstance(state);
   byte[] stateData = data.getProto().toByteArray();
   db.put(bytes(AMRMTOKEN_SECRET_MANAGER_ROOT), stateData);
 }
コード例 #2
0
 @Override
 public synchronized void storeOrUpdateAMRMTokenSecretManagerState(
     AMRMTokenSecretManagerState amrmTokenSecretManagerState, boolean isUpdate) throws Exception {
   Path nodeCreatePath = getNodePath(amrmTokenSecretManagerRoot, AMRMTOKEN_SECRET_MANAGER_NODE);
   AMRMTokenSecretManagerState data =
       AMRMTokenSecretManagerState.newInstance(amrmTokenSecretManagerState);
   byte[] stateData = data.getProto().toByteArray();
   if (isUpdate) {
     updateFile(nodeCreatePath, stateData, true);
   } else {
     writeFileWithRetries(nodeCreatePath, stateData, true);
   }
 }
コード例 #3
0
 private void loadAMRMTokenSecretManagerState(RMState rmState) throws IOException {
   try {
     byte[] data = db.get(bytes(AMRMTOKEN_SECRET_MANAGER_ROOT));
     if (data != null) {
       AMRMTokenSecretManagerStatePBImpl stateData =
           new AMRMTokenSecretManagerStatePBImpl(AMRMTokenSecretManagerStateProto.parseFrom(data));
       rmState.amrmTokenSecretManagerState =
           AMRMTokenSecretManagerState.newInstance(
               stateData.getCurrentMasterKey(), stateData.getNextMasterKey());
     }
   } catch (DBException e) {
     throw new IOException(e);
   }
 }
コード例 #4
0
 private void loadAMRMTokenSecretManagerState(RMState rmState) throws Exception {
   checkAndResumeUpdateOperation(amrmTokenSecretManagerRoot);
   Path amrmTokenSecretManagerStateDataDir =
       new Path(amrmTokenSecretManagerRoot, AMRMTOKEN_SECRET_MANAGER_NODE);
   FileStatus status = getFileStatusWithRetries(amrmTokenSecretManagerStateDataDir);
   if (status == null) {
     return;
   }
   assert status.isFile();
   byte[] data = readFileWithRetries(amrmTokenSecretManagerStateDataDir, status.getLen());
   AMRMTokenSecretManagerStatePBImpl stateData =
       new AMRMTokenSecretManagerStatePBImpl(AMRMTokenSecretManagerStateProto.parseFrom(data));
   rmState.amrmTokenSecretManagerState =
       AMRMTokenSecretManagerState.newInstance(
           stateData.getCurrentMasterKey(), stateData.getNextMasterKey());
 }