# 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()`
  Creates a new FastRateLimiter instance.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `TimeBucketCounter`
  `getBucketCounter()`
  Returns the internal instance of `TimeBucketCounterBase`.
  `protected String`
  `getDefaultPolicyName()`
  If policy name has not been specified, the first call of `RateLimiterBase.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 of `TimeBucketCounterBase` for specific time bucket size.

  ### Methods inherited from class RateLimiterBase

  `destroy, getDuration, getPolicyName, getRequests, increment, setDuration, setFilterConfig, setPolicyName, setRequests`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface RateLimiter

  `getPolicy, getQuota`

- ## Constructor Details

  - ### FastRateLimiter

    public FastRateLimiter()
    Creates a new FastRateLimiter instance.

- ## Method Details

  - ### getDefaultPolicyName

    protected String getDefaultPolicyName()
    Description copied from class: `RateLimiterBase`
    If policy name has not been specified, the first call of `RateLimiterBase.getPolicyName()` returns an auto-generated policy name using the default policy name as prefix and followed by auto-increase index.
    Specified by:
      `getDefaultPolicyName` in class `RateLimiterBase`
    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 of `TimeBucketCounterBase` for specific time bucket size. Concrete classes determine its counter policy by returning different implementation instances.
    Specified by:
      `newCounterInstance` in class `RateLimiterBase`
    Parameters:
      `duration` - size of each time bucket in seconds
      `executorService` - the executor
    Returns:
      counter instance of `TimeBucketCounterBase`

  - ### getBucketCounter

    public TimeBucketCounter getBucketCounter()
    Description copied from class: `RateLimiterBase`
    Returns the internal instance of `TimeBucketCounterBase`.
    Overrides:
      `getBucketCounter` in class `RateLimiterBase`
    Returns:
      instance of `TimeBucketCounterBase`