Class SharedRateLimiterFactory


  • public class SharedRateLimiterFactory
    extends Object
    Provides the ability to retrieve a RateLimiter keyed to a specific string, which will dynamically update its rate according to a specified callback function.
    • Method Detail

      • getInstance

        public static SharedRateLimiterFactory getInstance()
        Get the singleton instance of the SharedRateLimiterFactory.
      • create

        public RateLimiter create​(String name,
                                  SharedRateLimiterFactory.RateProvider rateProvider)
        Lookup the RateLimiter associated with the specified name, or create a new one for that name.
        Parameters:
        name - key for the rate limiter
        rateProvider - a function which can be called to get what the current rate for the rate limiter should be.
      • update

        protected void update()
        Walk through all of the currently active RateLimiters, having each update its current rate. This is called periodically so that we can dynamically update as configuration changes.
      • report

        protected void report()
        Walk through all of the currently active RateLimiters, having each report its activity to the debug log.