@InterfaceAudience.Private public class ReplicationThrottler extends Object
Modifier and Type | Field and Description |
---|---|
private double |
bandwidth |
private long |
cyclePushSize |
private long |
cycleStartTick |
private boolean |
enabled |
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
|
void |
setBandwidth(double bandwidth) |
private boolean enabled
private double bandwidth
private long cyclePushSize
private long cycleStartTick
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()
public void setBandwidth(double bandwidth)
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.