Class EnvoyRateLimiter
java.lang.Object
org.apache.beam.sdk.io.components.ratelimiter.EnvoyRateLimiter
- All Implemented Interfaces:
Serializable,AutoCloseable,RateLimiter
A lightweight handle for an Envoy-based rate limiter.
Delegates work to the EnvoyRateLimiterFactory using the baked-in EnvoyRateLimiterContext.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionEnvoyRateLimiter(EnvoyRateLimiterFactory factory, EnvoyRateLimiterContext context) -
Method Summary
-
Constructor Details
-
EnvoyRateLimiter
-
-
Method Details
-
allow
Description copied from interface:RateLimiterBlocks until the specified number of permits are acquired and returns true if the request was allowed or false if the request was rejected.- Specified by:
allowin interfaceRateLimiter- Parameters:
permits- Number of permits to acquire.- Returns:
- true if the request was allowed, false if it was rejected (and retries exceeded).
- Throws:
IOException- if there is an error communicating with the rate limiter service.InterruptedException- if the thread is interrupted while waiting.
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-