Class SharedRateLimiterFactory
- java.lang.Object
-
- org.apache.accumulo.core.util.ratelimit.SharedRateLimiterFactory
-
public class SharedRateLimiterFactory extends Object
Provides the ability to retrieve aRateLimiter
keyed to a specific string, which will dynamically update its rate according to a specified callback function.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
SharedRateLimiterFactory.RateProvider
A callback which provides the current rate for aRateLimiter
.protected class
SharedRateLimiterFactory.SharedRateLimiter
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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.
-
-
-
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 limiterrateProvider
- 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.
-
-