public class SharedRateLimiterFactory extends Object
RateLimiter
keyed to a specific string, which will
dynamically update its rate according to a specified callback function.Modifier and Type | Class and Description |
---|---|
static interface |
SharedRateLimiterFactory.RateProvider
A callback which provides the current rate for a
RateLimiter . |
protected class |
SharedRateLimiterFactory.SharedRateLimiter |
Modifier and Type | Method and Description |
---|---|
RateLimiter |
create(String name,
SharedRateLimiterFactory.RateProvider rateProvider)
Lookup the RateLimiter associated with the specified name, or create a new one for that name.
|
static SharedRateLimiterFactory |
getInstance()
Get the singleton instance of the SharedRateLimiterFactory.
|
protected void |
report()
Walk through all of the currently active RateLimiters, having each report its activity to the
debug log.
|
protected void |
update()
Walk through all of the currently active RateLimiters, having each update its current rate.
|
public static SharedRateLimiterFactory getInstance()
public RateLimiter create(String name, SharedRateLimiterFactory.RateProvider rateProvider)
name
- key for the rate limiterrateProvider
- a function which can be called to get what the current rate for the rate limiter
should be.protected void update()
protected void report()
Copyright © 2011–2018 The Apache Software Foundation. All rights reserved.