Package org.apache.catalina.util
Class FastRateLimiter
java.lang.Object
org.apache.catalina.util.FastRateLimiter
- All Implemented Interfaces:
- RateLimiter
A RateLimiter that compromises accuracy for speed in order to provide maximum throughput.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier 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.voidsetPolicyName(String name) Sets the policy name, otherwise an auto-generated name is used.voidsetRequests(int requests) Sets the configured number of requests allowed per time window.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.catalina.util.RateLimitergetPolicy, getQuota
- 
Constructor Details- 
FastRateLimiterpublic FastRateLimiter()
 
- 
- 
Method Details- 
getPolicyName- Specified by:
- getPolicyNamein interface- RateLimiter
- Returns:
- name of RateLimit policy
 
- 
setPolicyNameDescription copied from interface:RateLimiterSets the policy name, otherwise an auto-generated name is used.- Specified by:
- setPolicyNamein interface- RateLimiter
- Parameters:
- name- of rate limit policy
 
- 
getDurationpublic int getDuration()- Specified by:
- getDurationin interface- RateLimiter
- Returns:
- the actual duration of a time window in seconds
 
- 
setDurationpublic void setDuration(int duration) Description copied from interface:RateLimiterSets the configured duration value in seconds.- Specified by:
- setDurationin interface- RateLimiter
- Parameters:
- duration- The duration of the time window in seconds
 
- 
getRequestspublic int getRequests()- Specified by:
- getRequestsin interface- RateLimiter
- Returns:
- the maximum number of requests allowed per time window
 
- 
setRequestspublic void setRequests(int requests) Description copied from interface:RateLimiterSets the configured number of requests allowed per time window.- Specified by:
- setRequestsin interface- RateLimiter
- Parameters:
- requests- The number of requests per time window
 
- 
incrementDescription copied from interface:RateLimiterIncrements the number of requests by the given ipAddress in the current time window.- Specified by:
- incrementin interface- RateLimiter
- Parameters:
- ipAddress- the ip address
- Returns:
- the new value after incrementing
 
- 
destroypublic void destroy()Description copied from interface:RateLimiterCleanup no longer needed resources.- Specified by:
- destroyin interface- RateLimiter
 
- 
setFilterConfigDescription copied from interface:RateLimiterPass the FilterConfig to configure the filter.- Specified by:
- setFilterConfigin interface- RateLimiter
- Parameters:
- filterConfig- The FilterConfig used to configure the associated filter
 
- 
getBucketCounter
 
-