Package org.apache.catalina.util
Interface RateLimiter
- All Known Implementing Classes:
FastRateLimiter
public interface RateLimiter
-
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Cleanup no longer needed resources.intintintIncrements the number of requests by the given ipAddress in the current time window.voidsetDuration(int duration) Sets the configured duration value in seconds.voidsetFilterConfig(FilterConfig filterConfig) Pass the FilterConfig to configure the filter.voidsetRequests(int requests) Sets the configured number of requests allowed per time window.
-
Method Details
-
getDuration
int getDuration()- Returns:
- the actual duration of a time window in seconds
-
setDuration
void setDuration(int duration) Sets the configured duration value in seconds.- Parameters:
duration- The duration of the time window in seconds
-
getRequests
int getRequests()- Returns:
- the maximum number of requests allowed per time window
-
setRequests
void setRequests(int requests) Sets the configured number of requests allowed per time window.- Parameters:
requests- The number of requests per time window
-
increment
Increments the number of requests by the given ipAddress in the current time window.- Parameters:
ipAddress- the ip address- Returns:
- the new value after incrementing
-
destroy
void destroy()Cleanup no longer needed resources. -
setFilterConfig
Pass the FilterConfig to configure the filter.- Parameters:
filterConfig- The FilterConfig used to configure the associated filter
-