public class DataTransferThrottler extends Object
| Constructor and Description |
|---|
DataTransferThrottler(long bandwidthPerSec)
Constructor
|
DataTransferThrottler(long period,
long bandwidthPerSec)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
void |
throttle(long numOfBytes,
org.apache.hadoop.hdfs.util.Canceler canceler)
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.
|
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.public long getBandwidth()
public void setBandwidth(long bytesPerSecond)
public void throttle(long numOfBytes)
numOfBytes - number of bytes sent/received since last time throttle was calledpublic void throttle(long numOfBytes,
org.apache.hadoop.hdfs.util.Canceler canceler)
numOfBytes - number of bytes sent/received since last time throttle was calledcanceler - optional canceler to check for abort of throttleCopyright © 2022 Apache Software Foundation. All rights reserved.