|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hdfs.util.DataTransferThrottler
public class DataTransferThrottler
a class to throttle the data transfers. This class is thread safe. It can be shared by multiple threads. The parameter bandwidthPerSec specifies the total bandwidth shared by threads.
Constructor Summary | |
---|---|
DataTransferThrottler(long bandwidthPerSec)
Constructor |
|
DataTransferThrottler(long period,
long bandwidthPerSec)
Constructor |
Method Summary | |
---|---|
long |
getBandwidth()
|
void |
setBandwidth(long bytesPerSecond)
Sets throttle bandwidth. |
void |
throttle(long numOfBytes)
Given the numOfBytes sent/received since last time throttle was called, make the current thread sleep if I/O rate is too fast compared to the given bandwidth. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DataTransferThrottler(long bandwidthPerSec)
bandwidthPerSec
- bandwidth allowed in bytes per second.public DataTransferThrottler(long period, long bandwidthPerSec)
period
- in milliseconds. Bandwidth is enforced over this
period.bandwidthPerSec
- bandwidth allowed in bytes per second.Method Detail |
---|
public long getBandwidth()
public void setBandwidth(long bytesPerSecond)
bytesPerSecond
- public void throttle(long numOfBytes)
numOfBytes
- number of bytes sent/received since last time throttle was called
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |