Class ExactRateLimiter
java.lang.Object
org.apache.catalina.util.RateLimiterBase
org.apache.catalina.util.ExactRateLimiter
- All Implemented Interfaces:
RateLimiter
A RateLimiter that compromises efficiency for accuracy in order to provide exact rate limiting.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected String
If policy name has not been specified, the first call ofRateLimiterBase.getPolicyName()
returns an auto-generated policy name using the default policy name as prefix and followed by auto-increase index.protected TimeBucketCounterBase
newCounterInstance
(int duration, ScheduledExecutorService executorService) Instantiate an instance ofTimeBucketCounterBase
for specific time bucket size.Methods inherited from class org.apache.catalina.util.RateLimiterBase
destroy, getBucketCounter, getDuration, getPolicyName, getRequests, increment, setDuration, setFilterConfig, setPolicyName, setRequests
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.catalina.util.RateLimiter
getPolicy, getQuota
-
Constructor Details
-
ExactRateLimiter
public ExactRateLimiter()
-
-
Method Details
-
getDefaultPolicyName
Description copied from class:RateLimiterBase
If policy name has not been specified, the first call ofRateLimiterBase.getPolicyName()
returns an auto-generated policy name using the default policy name as prefix and followed by auto-increase index.- Specified by:
getDefaultPolicyName
in classRateLimiterBase
- Returns:
- default policy name, as a prefix of auto-generated policy name.
-
newCounterInstance
protected TimeBucketCounterBase newCounterInstance(int duration, ScheduledExecutorService executorService) Description copied from class:RateLimiterBase
Instantiate an instance ofTimeBucketCounterBase
for specific time bucket size. Concrete classes determine its counter policy by returning different implementation instances.- Specified by:
newCounterInstance
in classRateLimiterBase
- Parameters:
duration
- size of each time bucket in secondsexecutorService
- the executor- Returns:
- counter instance of
TimeBucketCounterBase
-