public class Throttler
extends java.lang.Object
| コンストラクタと説明 |
|---|
Throttler(java.lang.String name,
double maxRatePerSecond,
long rateIntervalMilliseconds)
Construct throttler.
|
| 修飾子とタイプ | メソッドと説明 |
|---|---|
void |
setMaxRatePerSecond(double maxRatePerSecond) |
void |
throttle()
When called on each request sleeps if called faster then configured average rate.
|
void |
throttle(int count) |
public Throttler(java.lang.String name,
double maxRatePerSecond,
long rateIntervalMilliseconds)
name - Human readable name of the resource being throttled. Used for logging only.maxRatePerSecond - maximum rate allowedrateIntervalMilliseconds - rate measurement interval. Interval should be at least
1000 / maxRatePerSecond.public void setMaxRatePerSecond(double maxRatePerSecond)
public void throttle(int count)
throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic void throttle()
throws java.lang.InterruptedException
java.lang.InterruptedException - when interrupted