org.apache.mina.filter
Class ReadThrottleFilterBuilder

java.lang.Object
  extended by org.apache.mina.filter.ReadThrottleFilterBuilder

public class ReadThrottleFilterBuilder
extends Object

This filter will automatically disable reads on an IoSession once the data batched for that session in the ExecutorFilter reaches a defined threshold (the default is 1 megabytes). It accomplishes this by being in the filter chain before and after the ExecutorFilter. It is possible to subvert the behavior of this filter by adding filters immediately after the ExecutorFilter after adding this filter. Thus, it is recommended to add this filter towards the end of your filter chain construction, if you need to ensure that other filters need to be right after the ExecutorFilter

Usage:


 DefaultFilterChainBuilder builder = ...
 ReadThrottleFilterBuilder filter = new ReadThrottleFilterBuilder();
 filter.attach( builder );
 
or

 IoFilterChain chain = ...
 ReadThrottleFilterBuilder filter = new ReadThrottleFilterBuilder();
 filter.attach( chain );
 

Version:
$Rev: 406554 $, $Date: 2006-05-15 06:46:02Z $
Author:
The Apache Directory Project (mina-dev@directory.apache.org)

Field Summary
static String COUNTER
           
static String SUSPENDED_READS
           
 
Constructor Summary
ReadThrottleFilterBuilder()
           
 
Method Summary
 void attach(DefaultIoFilterChainBuilder builder)
          Attach this filter to the specified builder.
 void attach(IoFilterChain chain)
          Attach this filter to the specified filter chain.
 void setMaximumConnectionBufferSize(int maximumConnectionBufferSize)
          Set the maximum amount of data to buffer in the ThreadPoolFilter prior to disabling reads.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COUNTER

public static final String COUNTER

SUSPENDED_READS

public static final String SUSPENDED_READS
Constructor Detail

ReadThrottleFilterBuilder

public ReadThrottleFilterBuilder()
Method Detail

setMaximumConnectionBufferSize

public void setMaximumConnectionBufferSize(int maximumConnectionBufferSize)
Set the maximum amount of data to buffer in the ThreadPoolFilter prior to disabling reads. Changing the value will only take effect when new data is received for a connection, including existing connections. Default value is 1 megabytes.

Parameters:
maximumConnectionBufferSize - New buffer size. Must be > 0

attach

public void attach(IoFilterChain chain)
Attach this filter to the specified filter chain. It will search for the ThreadPoolFilter, and attach itself before and after that filter.

Parameters:
chain - IoFilterChain to attach self to.

attach

public void attach(DefaultIoFilterChainBuilder builder)
Attach this filter to the specified builder. It will search for the ExecutorFilter, and attach itself before and after that filter.

Parameters:
builder - DefaultIoFilterChainBuilder to attach self to.