Package org.asynchttpclient.filter
Class ThrottleRequestFilter
- java.lang.Object
-
- org.asynchttpclient.filter.ThrottleRequestFilter
-
- All Implemented Interfaces:
RequestFilter
public class ThrottleRequestFilter extends Object implements RequestFilter
ARequestFilterthrottles 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)AnAsyncHttpClientwill 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:RequestFilterAnAsyncHttpClientwill invokeRequestFilter.filter(org.asynchttpclient.filter.FilterContext<T>)and will use the returnedFilterContext.getRequest()andFilterContext.getAsyncHandler()to continue the request processing.- Specified by:
filterin interfaceRequestFilter- Type Parameters:
T- the handler result type- Parameters:
ctx- aFilterContext- Returns:
FilterContext. TheFilterContextinstance may not the same as the original one.- Throws:
FilterException- to interrupt the filter processing.
-
-