Package org.apache.catalina.util
Class FastRateLimiter
- java.lang.Object
-
- org.apache.catalina.util.RateLimiterBase
-
- org.apache.catalina.util.FastRateLimiter
-
- All Implemented Interfaces:
RateLimiter
public class FastRateLimiter extends RateLimiterBase
A RateLimiter that compromises accuracy for speed in order to provide maximum throughput.
-
-
Constructor Summary
Constructors Constructor Description FastRateLimiter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TimeBucketCountergetBucketCounter()Returns the internal instance ofTimeBucketCounterBase.protected java.lang.StringgetDefaultPolicyName()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 TimeBucketCounterBasenewCounterInstance(int duration, java.util.concurrent.ScheduledExecutorService executorService)Instantiate an instance ofTimeBucketCounterBasefor specific time bucket size.-
Methods inherited from class org.apache.catalina.util.RateLimiterBase
destroy, 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
-
-
-
-
Method Detail
-
getDefaultPolicyName
protected java.lang.String getDefaultPolicyName()
Description copied from class:RateLimiterBaseIf 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:
getDefaultPolicyNamein classRateLimiterBase- Returns:
- default policy name, as a prefix of auto-generated policy name.
-
newCounterInstance
protected TimeBucketCounterBase newCounterInstance(int duration, java.util.concurrent.ScheduledExecutorService executorService)
Description copied from class:RateLimiterBaseInstantiate an instance ofTimeBucketCounterBasefor specific time bucket size. Concrete classes determine its counter policy by returning different implementation instances.- Specified by:
newCounterInstancein classRateLimiterBase- Parameters:
duration- size of each time bucket in secondsexecutorService- the executor- Returns:
- counter instance of
TimeBucketCounterBase
-
getBucketCounter
public TimeBucketCounter getBucketCounter()
Description copied from class:RateLimiterBaseReturns the internal instance ofTimeBucketCounterBase.- Overrides:
getBucketCounterin classRateLimiterBase- Returns:
- instance of
TimeBucketCounterBase
-
-