withMaxAttempts


Description:

public Result<Retry,Error> withMaxAttempts (int n)

Sets maximum attempts.

The first execution counts as attempt 1.

Parameters:

n

maximum attempts (must be positive).

Returns:

Result.ok(this retry instance), or Result.error(RetryError.INVALID_ARGUMENT) when n is not positive.