public class Throttle extends Object
Constructor and Description |
---|
Throttle(DriverContext ctx)
Constructs a throttle.
|
Modifier and Type | Method and Description |
---|---|
boolean |
isThrottled(int direction)
Checks whether the bandwidth is throttled for the given direction
|
void |
throttle(int bytes,
long startTime,
int direction)
The throttle sleeps until the calculated time for the request has
expired, before continuing with subsequent I/O.
|
public static final int UP
public static final int DOWN
public Throttle(DriverContext ctx)
ctx
- The driver contextpublic boolean isThrottled(int direction)
direction
- The direction to checkpublic void throttle(int bytes, long startTime, int direction)
bytes
- The size of the data sent/receivedstartTime
- The start time of the send/receivedirection
- The direction, up or down