Class Throttle
java.lang.Object
org.apache.synapse.commons.throttle.core.Throttle
The representation for Throttle - holds the both of runtime and static data.
There is a one to one relationship between each throttle configuration and context.
Currently support two type of throttle configuration. One is remote caller IP based and
other one is remote caller domain name based.There may be a concurrent access controller,
if the throttle policy has defined the maximum concurrent access .
-
Constructor Summary
ConstructorsConstructorDescriptionThrottle()Default Constructor - initiates the context and configuration maps -
Method Summary
Modifier and TypeMethodDescriptionvoidaddThrottleConfiguration(String key, ThrottleConfiguration throttleConfiguration) Adds a ThrottleConfiguration with the given key - configuration holds all static data for registered callersvoidaddThrottleContext(String key, ThrottleContext throttleContext) Adds a ThrotleContext with the given key - context holds all runtime data for registered callersReturns the ConcurrentAccessController - this will control all the concurrent accessgetId()Returns the unique identifier for this throttleReturns the ThrottleConfiguration for a given key - configuration holds all static data for registered callersgetThrottleContext(String contextID) Returns the ThrotleContext for a given key - context holds all runtime data for registered callersvoidSets the ConcurrentAccessController - this will control all the concurrent accessvoidSets the unique identifier for this throttle
-
Constructor Details
-
Throttle
public Throttle()Default Constructor - initiates the context and configuration maps
-
-
Method Details
-
addThrottleConfiguration
Adds a ThrottleConfiguration with the given key - configuration holds all static data for registered callers- Parameters:
key- - corresponding key for throttle type.This key has one-one relationship with key of contextsthrottleConfiguration- - holds all static data for a throttle - ex: all callers configurations
-
addThrottleContext
Adds a ThrotleContext with the given key - context holds all runtime data for registered callers- Parameters:
key- - corresponding key for throttle type.This key has one-one relationship with key of configurationsthrottleContext- - holds runtime data - ex: all callers states
-
getThrottleContext
Returns the ThrotleContext for a given key - context holds all runtime data for registered callers- Parameters:
contextID- - corresponding key for throttle type- Returns:
- ThrottleContext returns the context that holds runtime data - ex: all callers state
-
getThrottleConfiguration
Returns the ThrottleConfiguration for a given key - configuration holds all static data for registered callers- Parameters:
key- -corresponding key for throttle type- Returns:
- ThrottleConfiguration Returns configuration that holds all static data for a throttle - ex: all callers configurations
-
setConcurrentAccessController
Sets the ConcurrentAccessController - this will control all the concurrent access- Parameters:
controller- - the ConcurrentAccessController instance
-
getConcurrentAccessController
Returns the ConcurrentAccessController - this will control all the concurrent access- Returns:
- the ConcurrentAccessController instance
-
getId
Returns the unique identifier for this throttle- Returns:
- String representation of the id
-
setId
Sets the unique identifier for this throttle- Parameters:
id- String representation of the id
-