public class ThrottleRequestFilter extends Object implements RequestFilter
RequestFilter
throttles requests and block when the number of permits is reached, waiting for
the response to arrives before executing the next request.Constructor and Description |
---|
ThrottleRequestFilter(int maxConnections) |
ThrottleRequestFilter(int maxConnections,
int maxWait) |
ThrottleRequestFilter(int maxConnections,
int maxWait,
boolean fair) |
Modifier and Type | Method and Description |
---|---|
<T> FilterContext<T> |
filter(FilterContext<T> ctx)
An
AsyncHttpClient will invoke RequestFilter.filter(org.asynchttpclient.filter.FilterContext<T>) and will use the
returned FilterContext.getRequest() and FilterContext.getAsyncHandler() to continue the request
processing. |
public ThrottleRequestFilter(int maxConnections)
public ThrottleRequestFilter(int maxConnections, int maxWait)
public ThrottleRequestFilter(int maxConnections, int maxWait, boolean fair)
public <T> FilterContext<T> filter(FilterContext<T> ctx) throws FilterException
AsyncHttpClient
will invoke RequestFilter.filter(org.asynchttpclient.filter.FilterContext<T>)
and will use the
returned FilterContext.getRequest()
and FilterContext.getAsyncHandler()
to continue the request
processing.filter
in interface RequestFilter
T
- the handler result typectx
- a FilterContext
FilterContext
. The FilterContext
instance may not the same as the original one.FilterException
- to interrupt the filter processing.Copyright © 2016. All Rights Reserved.