public abstract class AbstractThrottlingConfiguration extends Object implements ThrottlingConfiguration
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_INTERVAL
Default time interval (in seconds).
|
static int |
DEFAULT_LIMIT
Default max.
|
protected static org.slf4j.Logger |
LOG |
Constructor and Description |
---|
AbstractThrottlingConfiguration() |
Modifier and Type | Method and Description |
---|---|
protected void |
addProperty(String sourceSystem,
String serviceName,
int interval,
int limit)
Adds new configuration property or updates already existing property.
|
Map<ThrottleScope,ThrottleProps> |
getProperties()
Gets all throttling properties.
|
ThrottleProps |
getThrottleProps(ThrottleScope inScope)
Gets throttle properties for most equal scope.
|
boolean |
isThrottlingDisabled()
Is throttling disabled at all?
|
void |
setThrottlingDisabled(boolean throttlingDisabled)
Sets true for disabling throttling.
|
protected static final org.slf4j.Logger LOG
public static final int DEFAULT_INTERVAL
public static final int DEFAULT_LIMIT
@Nullable public final ThrottleProps getThrottleProps(ThrottleScope inScope)
ThrottlingConfiguration
getThrottleProps
in interface ThrottlingConfiguration
inScope
- the scope of the incoming requestnull
if there is no properties for specified scopeprotected final void addProperty(String sourceSystem, String serviceName, int interval, int limit)
sourceSystem
- the source system, can be used '*' for any systemserviceName
- the service name, can be used '*' for any systeminterval
- the time interval in secondslimit
- the limit of requests for specified intervalpublic final Map<ThrottleScope,ThrottleProps> getProperties()
getProperties
in interface ThrottlingConfiguration
public boolean isThrottlingDisabled()
isThrottlingDisabled
in interface ThrottlingConfiguration
true
for disablingpublic void setThrottlingDisabled(boolean throttlingDisabled)
throttlingDisabled
- true for disabling throttlingCopyright © 2018 Pivotal Software, Inc.. All rights reserved.