Class DefaultRateThrottlingPolicy
- java.lang.Object
-
- org.forgerock.openig.filter.throttling.DefaultRateThrottlingPolicy
-
- All Implemented Interfaces:
ThrottlingPolicy
public class DefaultRateThrottlingPolicy extends Object implements ThrottlingPolicy
ADefaultRateThrottlingPolicy
is a delegatingThrottlingPolicy
that ensures the returnedThrottlingRate
is never null. If the delegatedThrottlingPolicy
returnsnull
, then it returns the specified default rate.
-
-
Constructor Summary
Constructors Constructor Description DefaultRateThrottlingPolicy(ThrottlingRate defaultRate, ThrottlingPolicy delegate)
Constructs a newDefaultRateThrottlingPolicy
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Promise<ThrottlingRate,Exception>
lookup(Context context, Request request)
Returns theThrottlingRate
that should be used for the provided request.
-
-
-
Constructor Detail
-
DefaultRateThrottlingPolicy
public DefaultRateThrottlingPolicy(ThrottlingRate defaultRate, ThrottlingPolicy delegate)
Constructs a newDefaultRateThrottlingPolicy
.- Parameters:
defaultRate
- the rate to return if the one returned by the delegate is null.delegate
- the wrapped datasource to execute
-
-
Method Detail
-
lookup
public Promise<ThrottlingRate,Exception> lookup(Context context, Request request)
Description copied from interface:ThrottlingPolicy
Returns theThrottlingRate
that should be used for the provided request.- Specified by:
lookup
in 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
Promise
representing theThrottlingRate
that should be used for the request.
-
-