public abstract class RateLimiter extends Object
pause(long)
whenever the have read
or written more than getMinPauseCheckBytes()
bytes.Modifier and Type | Class and Description |
---|---|
static class |
RateLimiter.SimpleRateLimiter
Simple class to rate limit IO.
|
Constructor and Description |
---|
RateLimiter() |
Modifier and Type | Method and Description |
---|---|
abstract double |
getMBPerSec()
The current MB per second rate limit.
|
abstract long |
getMinPauseCheckBytes()
How many bytes caller should add up itself before invoking
pause(long) . |
abstract long |
pause(long bytes)
Pauses, if necessary, to keep the instantaneous IO
rate at or below the target.
|
abstract void |
setMBPerSec(double mbPerSec)
Sets an updated MB per second rate limit.
|
public abstract void setMBPerSec(double mbPerSec)
public abstract double getMBPerSec()
public abstract long pause(long bytes) throws IOException
Note: the implementation is thread-safe
IOException
public abstract long getMinPauseCheckBytes()
pause(long)
.Copyright © 2000-2018 Apache Software Foundation. All Rights Reserved.