com.sun.faban.driver.transport.util
Class Throttle
java.lang.Object
com.sun.faban.driver.transport.util.Throttle
public class Throttle
- extends Object
A helper class to provide throttling on sockets
- Author:
- Scott Oaks
Field Summary |
static int |
DOWN
|
static int |
UP
|
Method Summary |
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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
UP
public static final int UP
- See Also:
- Constant Field Values
DOWN
public static final int DOWN
- See Also:
- Constant Field Values
Throttle
public Throttle(DriverContext ctx)
- Constructs a throttle.
- Parameters:
ctx
- The driver context
isThrottled
public boolean isThrottled(int direction)
- Checks whether the bandwidth is throttled for the given direction
- Parameters:
direction
- The direction to check
- Returns:
- Whether the bandwidth is throttled
throttle
public 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.
- Parameters:
bytes
- The size of the data sent/receivedstartTime
- The start time of the send/receivedirection
- The direction, up or down