com.ning.http.client.extra
Class ThrottleRequestFilter

java.lang.Object
  extended by com.ning.http.client.extra.ThrottleRequestFilter
All Implemented Interfaces:
RequestFilter

public class ThrottleRequestFilter
extends Object
implements 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
ThrottleRequestFilter(int maxConnections)
           
ThrottleRequestFilter(int maxConnections, int maxWait)
           
 
Method Summary
 FilterContext filter(FilterContext ctx)
          An AsyncHttpProvider will invoke RequestFilter.filter(com.ning.http.client.filter.FilterContext) and will use the returned FilterContext.getRequest() and FilterContext.getAsyncHandler() to continue the request processing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThrottleRequestFilter

public ThrottleRequestFilter(int maxConnections)

ThrottleRequestFilter

public ThrottleRequestFilter(int maxConnections,
                             int maxWait)
Method Detail

filter

public FilterContext filter(FilterContext ctx)
                     throws FilterException
Description copied from interface: RequestFilter
An AsyncHttpProvider will invoke RequestFilter.filter(com.ning.http.client.filter.FilterContext) and will use the returned FilterContext.getRequest() and FilterContext.getAsyncHandler() to continue the request processing.

Specified by:
filter in interface RequestFilter
Parameters:
ctx - a FilterContext
Returns:
FilterContext. The FilterContext instance may not the same as the original one.
Throws:
FilterException - to interrupt the filter processing.


Copyright © 2011. All Rights Reserved.