Class MappedThrottlingPolicy
java.lang.Object
org.forgerock.openig.filter.throttling.MappedThrottlingPolicy
- All Implemented Interfaces:
ThrottlingPolicy
Implementation of
ThrottlingPolicy backed by a Map.
- if the key is null, then the
defaultRateis returned - if the key can be looked up as key in the
throttlingRatesMapping, then the matching rate is returned - if the key can't be looked up in the
throttlingRatesMapping, then thedefaultRateis returned
-
Constructor Summary
ConstructorsConstructorDescriptionMappedThrottlingPolicy(AsyncFunction<ContextAndRequest, String, Exception> throttlingRateMapper, Map<String, ThrottlingRate> throttlingRatesMapping, ThrottlingRate defaultRate) Constructs a newMappedThrottlingPolicy. -
Method Summary
Modifier and TypeMethodDescriptionReturns theThrottlingRatethat should be used for the provided request.
-
Constructor Details
-
MappedThrottlingPolicy
public MappedThrottlingPolicy(AsyncFunction<ContextAndRequest, String, Exception> throttlingRateMapper, Map<String, ThrottlingRate> throttlingRatesMapping, ThrottlingRate defaultRate) Constructs a newMappedThrottlingPolicy.- Parameters:
throttlingRateMapper- the key to lookup the throttling ratethrottlingRatesMapping- the Map to look into to find the matching throttling rate.defaultRate- the default throttling definition.
-
-
Method Details
-
lookup
Description copied from interface:ThrottlingPolicyReturns theThrottlingRatethat should be used for the provided request.- Specified by:
lookupin interfaceThrottlingPolicy- Parameters:
context- The current context which might be used to retrieve the throttling rate.request- The current request which might be used to retrieve the throttling rate.- Returns:
- A
Promiserepresenting theThrottlingRatethat should be used for the request.
-