public class DefaultRateThrottlingPolicy extends Object implements ThrottlingPolicy
DefaultRateThrottlingPolicy
is a delegating ThrottlingPolicy
that ensures the returned
ThrottlingRate
is never null. If the delegated ThrottlingPolicy
returns null
, then it
returns the specified default rate.Constructor and Description |
---|
DefaultRateThrottlingPolicy(ThrottlingRate defaultRate,
ThrottlingPolicy delegate)
Constructs a new
DefaultRateThrottlingPolicy . |
Modifier and Type | Method and Description |
---|---|
org.forgerock.util.promise.Promise<ThrottlingRate,Exception> |
lookup(org.forgerock.services.context.Context context,
org.forgerock.http.protocol.Request request)
Returns the
ThrottlingRate that should be used for the provided request. |
public DefaultRateThrottlingPolicy(ThrottlingRate defaultRate, ThrottlingPolicy delegate)
DefaultRateThrottlingPolicy
.defaultRate
- the rate to return if the one returned by the delegate is null.delegate
- the wrapped datasource to executepublic org.forgerock.util.promise.Promise<ThrottlingRate,Exception> lookup(org.forgerock.services.context.Context context, org.forgerock.http.protocol.Request request)
ThrottlingPolicy
ThrottlingRate
that should be used for the provided request.lookup
in interface ThrottlingPolicy
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.Promise
representing the ThrottlingRate
that should be used for the request.Copyright © 2025 Open Identity Platform Community. All rights reserved.