@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);
 }
 @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);
   }
 }
 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);
   }
 }
 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());
 }