public Operation getBackupOperation() {
   List<Operation> backupOpList = new ArrayList<Operation>();
   for (Operation operation : opList) {
     if (operation instanceof BackupAwareOperation) {
       BackupAwareOperation backupAwareOperation = (BackupAwareOperation) operation;
       if (backupAwareOperation.shouldBackup()) {
         backupOpList.add(backupAwareOperation.getBackupOperation());
       }
     }
   }
   return new TxnCommitBackupOperation(name, dataKey, backupOpList, getCallerUuid(), threadId);
 }
  private int requestedTotalBackups(BackupAwareOperation op) {
    int backups = op.getSyncBackupCount() + op.getAsyncBackupCount();

    if (backups > MAX_BACKUP_COUNT) {
      throw new IllegalArgumentException(
          "Can't create backup for Operation:"
              + op
              + ", the sum of async and sync backups is larger than "
              + MAX_BACKUP_COUNT
              + ", sync backup count is "
              + op.getSyncBackupCount()
              + ", async backup count is "
              + op.getAsyncBackupCount());
    }

    return backups;
  }
 private Data getBackupOperationData(BackupAwareOperation backupAwareOp) {
   Operation backupOp = backupAwareOp.getBackupOperation();
   if (backupOp == null) {
     throw new IllegalArgumentException("Backup operation should not be null! " + backupAwareOp);
   }
   Operation op = (Operation) backupAwareOp;
   // set service name of backup operation.
   // if getServiceName() method is overridden to return the same name
   // then this will have no effect.
   backupOp.setServiceName(op.getServiceName());
   return nodeEngine.getSerializationService().toData(backupOp);
 }
  private int requestedSyncBackups(BackupAwareOperation op) {
    int backups = op.getSyncBackupCount();

    if (backups < 0) {
      throw new IllegalArgumentException(
          "Can't create backup for Operation:"
              + op
              + ", sync backup count can't be smaller than 0, but found: "
              + backups);
    }

    if (backups > MAX_BACKUP_COUNT) {
      throw new IllegalArgumentException(
          "Can't create backup for Operation:"
              + op
              + ", sync backup count can't be larger than "
              + MAX_BACKUP_COUNT
              + ", but found: "
              + backups);
    }
    return backups;
  }