public class SizeBasedThrottler extends Object
Constructor and Description |
---|
SizeBasedThrottler(long threshold)
Creates SizeBoundary with provided threshold
|
Modifier and Type | Method and Description |
---|---|
long |
decrease(long delta)
Decreases value of internal counter.
|
long |
getCurrentValue() |
long |
getThreshold() |
long |
increase(long delta)
Blocks until internal counter is lower than threshold
and then increases value of internal counter.
|
public SizeBasedThrottler(long threshold)
threshold
- threshold used by instancepublic long increase(long delta) throws InterruptedException
delta
- increase internal counter by this valueInterruptedException
- when interrupted during waitingpublic long decrease(long delta)
delta
- decrease internal counter by this valuepublic long getCurrentValue()
public long getThreshold()
Copyright © 2014 The Apache Software Foundation. All Rights Reserved.