public class TimeAndErrorsThrottler<S extends TimeAndErrorsState> extends Throttler<S>
alwaysThrottleParam| Constructor and Description |
|---|
TimeAndErrorsThrottler(Duration requestTimeThreshold,
Callable<S> createThrottlingState,
com.google.common.cache.Cache<Object,S> stateStore,
String enableThrottlingIfHeader,
String alwaysThrottleParam,
Clock clock)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
failure(Object bucket,
javax.servlet.http.HttpServletRequest request,
Duration elapsed)
Notify this throttler that a request has completed in error.
|
protected Instant |
internalThrottledUntil(Object bucket,
javax.servlet.http.HttpServletRequest request)
Implemented by clients for the specific throttling logic.
|
void |
success(Object bucket,
javax.servlet.http.HttpServletRequest request,
Duration elapsed)
Notify this throttler that a request has been completed successfully.
|
getState, getStateIfPresent, shouldBypassThrottling, throttledDuration, throttledUntilpublic TimeAndErrorsThrottler(Duration requestTimeThreshold, Callable<S> createThrottlingState, com.google.common.cache.Cache<Object,S> stateStore, String enableThrottlingIfHeader, String alwaysThrottleParam, Clock clock)
requestTimeThreshold - requests longer than this will trigger
tracking resource consumptioncreateThrottlingState - how to create the initial throttling state
when we start tracking a specific clientstateStore - the cache in which we store the per client state of
throttlingenableThrottlingIfHeader - throttling is only enabled if this header is presentalwaysThrottleParam - this query parameter will cause throttling no matter whatpublic void success(Object bucket, javax.servlet.http.HttpServletRequest request, Duration elapsed)
bucket - the bucket to which this request belongsrequest - the requestelapsed - how long that request tookpublic void failure(Object bucket, javax.servlet.http.HttpServletRequest request, Duration elapsed)
bucket - the bucket to which this request belongsrequest - the requestelapsed - how long that request tookprotected Instant internalThrottledUntil(Object bucket, javax.servlet.http.HttpServletRequest request)
ThrottlerinternalThrottledUntil in class Throttler<S extends TimeAndErrorsState>Throttler.throttledUntil(Object, HttpServletRequest)Copyright © 2019. All rights reserved.