public static class RateLimiter.SimpleRateLimiter extends RateLimiter
RateLimiter.SimpleRateLimiter
Constructor and Description |
---|
SimpleRateLimiter(double mbPerSec)
mbPerSec is the MB/sec max IO rate
|
Modifier and Type | Method and Description |
---|---|
double |
getMBPerSec()
The current mb per second rate limit.
|
long |
getMinPauseCheckBytes()
How many bytes caller should add up itself before invoking
RateLimiter.pause(long) . |
long |
pause(long bytes)
Pauses, if necessary, to keep the instantaneous IO
rate at or below the target.
|
void |
setMBPerSec(double mbPerSec)
Sets an updated mb per second rate limit.
|
public SimpleRateLimiter(double mbPerSec)
public void setMBPerSec(double mbPerSec)
setMBPerSec
in class RateLimiter
public long getMinPauseCheckBytes()
RateLimiter
RateLimiter.pause(long)
.
NOTE: The value returned by this method may change over time and is not guaranteed
to be constant throughout the lifetime of the RateLimiter. Users are advised to
refresh their local values with calls to this method to ensure consistency.getMinPauseCheckBytes
in class RateLimiter
public double getMBPerSec()
getMBPerSec
in class RateLimiter
public long pause(long bytes)
getMinPauseCheckBytes()
,
otherwise it will pause way too long!pause
in class RateLimiter
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.