Package org.apache.mina.filter
Class ReadThrottleFilterBuilder
- java.lang.Object
-
- org.apache.mina.filter.ReadThrottleFilterBuilder
-
public class ReadThrottleFilterBuilder extends java.lang.ObjectThis filter will automatically disable reads on anIoSessiononce the data batched for that session in theExecutorFilterreaches a defined threshold (the default is 1 megabytes). It accomplishes this by being in the filter chain before and after theExecutorFilter. It is possible to subvert the behavior of this filter by adding filters immediately after theExecutorFilterafter 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 theExecutorFilterUsage:
orDefaultFilterChainBuilder builder = ... ReadThrottleFilterBuilder filter = new ReadThrottleFilterBuilder(); filter.attach( builder );IoFilterChain chain = ... ReadThrottleFilterBuilder filter = new ReadThrottleFilterBuilder(); filter.attach( chain );
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCOUNTERstatic java.lang.StringSUSPENDED_READS
-
Constructor Summary
Constructors Constructor Description ReadThrottleFilterBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidattach(DefaultIoFilterChainBuilder builder)Attach this filter to the specified builder.voidattach(IoFilterChain chain)Attach this filter to the specified filter chain.voidsetMaximumConnectionBufferSize(int maximumConnectionBufferSize)Set the maximum amount of data to buffer in the ThreadPoolFilter prior to disabling reads.
-
-
-
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-IoFilterChainto attach self to.
-
attach
public void attach(DefaultIoFilterChainBuilder builder)
Attach this filter to the specified builder. It will search for theExecutorFilter, and attach itself before and after that filter.- Parameters:
builder-DefaultIoFilterChainBuilderto attach self to.
-
-