public Retryer < R > stopAfterAttempt ( final int maxAttemptNumber ) { checkArgument ( maxAttemptNumber >= 1 , "maxAttemptNumber must be >= 1 but is %d" , maxAttemptNumber ) ; return withStopStrategy ( new StopStrategy ( ) { @ Override public boolean shouldStop ( int previousAttemptNumber , long delaySinceFirstAttemptInMillis ) { return previousAttemptNumber >= maxAttemptNumber ; } } ) ; }
Sets the stop strategy which stops after N failed attempts