public static RequestLimitRule of ( Duration duration , long limit ) { checkDuration ( duration ) ; if ( limit < 0 ) { throw new IllegalArgumentException ( "limit must be greater than zero." ) ; } int durationSeconds = ( int ) duration . getSeconds ( ) ; return new RequestLimitRule ( durationSeconds , limit , durationSeconds ) ; }
Initialise a request rate limit . Imagine the whole duration window as being one large bucket with a single count .