@InterfaceAudience.Private public class ReplicationThrottler extends Object
Constructor and Description |
---|
ReplicationThrottler(double bandwidth)
ReplicationThrottler constructor
If bandwidth less than 1, throttling is disabled
|
Modifier and Type | Method and Description |
---|---|
void |
addPushSize(int size)
Add current size to the current cycle's total push size
|
long |
getNextSleepInterval(int size)
Get how long the caller should sleep according to the current size and
current cycle's total push size and start tick, return the sleep interval
for throttling control.
|
boolean |
isEnabled()
If throttling is enabled
|
void |
resetStartTick()
Reset the cycle start tick to NOW
|
public ReplicationThrottler(double bandwidth)
bandwidth
- per cycle(100ms)public boolean isEnabled()
public long getNextSleepInterval(int size)
size
- is the size of edits to be pushedpublic void addPushSize(int size)
size
- is the current size added to the current cycle's
total push sizepublic void resetStartTick()
Copyright © 2007-2016 The Apache Software Foundation. All Rights Reserved.