public TableRetryPolicy withStopAfterAttempts(int maxAttempts) {
    Preconditions.checkArgument(maxAttempts >= 0);
    this.maxAttempts = maxAttempts;
    return this;
  }
Set maximum number of attempts before terminating the operation.
@param maxAttempts number of attempts
@return this policy instance
samza-api/src/main/java/org/apache/samza/table/retry/TableRetryPolicy.java