Package org.asynchttpclient.filter
Class ThrottleRequestFilter
- java.lang.Object
-
- org.asynchttpclient.filter.ThrottleRequestFilter
-
- All Implemented Interfaces:
RequestFilter
public class ThrottleRequestFilter extends Object implements RequestFilter
ARequestFilter
throttles requests and block when the number of permits is reached, waiting for the response to arrives before executing the next request.
-
-
Constructor Summary
Constructors Constructor Description ThrottleRequestFilter(int maxConnections)
ThrottleRequestFilter(int maxConnections, int maxWait)
ThrottleRequestFilter(int maxConnections, int maxWait, boolean fair)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> FilterContext<T>
filter(FilterContext<T> ctx)
AnAsyncHttpClient
will invokeRequestFilter.filter(org.asynchttpclient.filter.FilterContext<T>)
and will use the returnedFilterContext.getRequest()
andFilterContext.getAsyncHandler()
to continue the request processing.
-
-
-
Method Detail
-
filter
public <T> FilterContext<T> filter(FilterContext<T> ctx) throws FilterException
Description copied from interface:RequestFilter
AnAsyncHttpClient
will invokeRequestFilter.filter(org.asynchttpclient.filter.FilterContext<T>)
and will use the returnedFilterContext.getRequest()
andFilterContext.getAsyncHandler()
to continue the request processing.- Specified by:
filter
in interfaceRequestFilter
- Type Parameters:
T
- the handler result type- Parameters:
ctx
- aFilterContext
- Returns:
FilterContext
. TheFilterContext
instance may not the same as the original one.- Throws:
FilterException
- to interrupt the filter processing.
-
-