public class CallLimiter
extends java.lang.Object
| Constructor and Description |
|---|
CallLimiter(int largeTimeFrame,
int largeCallsLimit,
java.util.concurrent.TimeUnit largeTimeUnit,
int smallTimeFrame,
int smallCallLimit,
java.util.concurrent.TimeUnit smallTimeUnit,
long shutdownPeriodInMinutes)
Recommended constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
checkAndIncrease()
Check if next call is allowed and increase the counts.
|
public CallLimiter(int largeTimeFrame,
int largeCallsLimit,
java.util.concurrent.TimeUnit largeTimeUnit,
int smallTimeFrame,
int smallCallLimit,
java.util.concurrent.TimeUnit smallTimeUnit,
long shutdownPeriodInMinutes)
largeTimeFrame - Time frame for large call limit.largeCallsLimit - Number of calls allowed in large timescale. Calling more times will result in a shutdown scenario.largeTimeUnit - Time units in which the large time frame is provided.smallTimeFrame - Time frame for small call limit.smallCallLimit - Number of calls allowed in small timescale.smallTimeUnit - Time units in which the small time frame is provided.shutdownPeriodInMinutes - For how long the calls will be blocked after reaching large limit.