Пример #1
0
  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;
  }
Пример #2
0
  private int requestedAsyncBackups(BackupAwareOperation op) {
    int backups = op.getAsyncBackupCount();

    if (backups < 0) {
      throw new IllegalArgumentException(
          "Can't create backup for Operation:"
              + op
              + ", async 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
              + ", async backup count can't be larger than "
              + MAX_BACKUP_COUNT
              + ", but found: "
              + backups);
    }

    return backups;
  }