Class GuavaFlinkConnectorRateLimiter
- java.lang.Object
-
- org.apache.flink.api.common.io.ratelimiting.GuavaFlinkConnectorRateLimiter
-
- All Implemented Interfaces:
Serializable
,FlinkConnectorRateLimiter
public class GuavaFlinkConnectorRateLimiter extends Object implements FlinkConnectorRateLimiter
An implementation ofFlinkConnectorRateLimiter
that uses Guava's RateLimiter for rate limiting.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description GuavaFlinkConnectorRateLimiter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
acquire(int permits)
Acquires permits for the rate limiter.void
close()
long
getRate()
void
open(RuntimeContext runtimeContext)
Creates a rate limiter with the runtime context provided.void
setRate(long globalRate)
Set the global per consumer and per sub-task rates.
-
-
-
Method Detail
-
open
public void open(RuntimeContext runtimeContext)
Creates a rate limiter with the runtime context provided.- Specified by:
open
in interfaceFlinkConnectorRateLimiter
- Parameters:
runtimeContext
-
-
setRate
public void setRate(long globalRate)
Set the global per consumer and per sub-task rates.- Specified by:
setRate
in interfaceFlinkConnectorRateLimiter
- Parameters:
globalRate
- Value of rate in bytes per second.
-
acquire
public void acquire(int permits)
Description copied from interface:FlinkConnectorRateLimiter
Acquires permits for the rate limiter.- Specified by:
acquire
in interfaceFlinkConnectorRateLimiter
-
getRate
public long getRate()
- Specified by:
getRate
in interfaceFlinkConnectorRateLimiter
-
close
public void close()
- Specified by:
close
in interfaceFlinkConnectorRateLimiter
-
-