Package com.ning.http.client.extra
Class ThrottleRequestFilter
java.lang.Object
com.ning.http.client.extra.ThrottleRequestFilter
- All Implemented Interfaces:
RequestFilter
A
RequestFilter throttles requests and block when the number of permits is reached, waiting for
the response to arrives before executing the next request.-
Constructor Summary
ConstructorsConstructorDescriptionThrottleRequestFilter(int maxConnections) ThrottleRequestFilter(int maxConnections, int maxWait) -
Method Summary
Modifier and TypeMethodDescriptionfilter(FilterContext ctx) AnAsyncHttpProviderwill invokeRequestFilter.filter(com.ning.http.client.filter.FilterContext<T>)and will use the returnedFilterContext.getRequest()andFilterContext.getAsyncHandler()to continue the request processing.
-
Constructor Details
-
ThrottleRequestFilter
public ThrottleRequestFilter(int maxConnections) -
ThrottleRequestFilter
public ThrottleRequestFilter(int maxConnections, int maxWait)
-
-
Method Details
-
filter
Description copied from interface:RequestFilterAnAsyncHttpProviderwill invokeRequestFilter.filter(com.ning.http.client.filter.FilterContext<T>)and will use the returnedFilterContext.getRequest()andFilterContext.getAsyncHandler()to continue the request processing.- Specified by:
filterin interfaceRequestFilter- Parameters:
ctx- aFilterContext- Returns:
FilterContext. TheFilterContextinstance may not the same as the original one.- Throws:
FilterException- to interrupt the filter processing.
-