|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.mina.common.IoFilterAdapter
org.apache.mina.filter.traffic.WriteThrottleFilter
public class WriteThrottleFilter
An IoFilter that throttles outgoing traffic to prevent a unwanted
OutOfMemoryError under heavy load.
This filter will automatically enforce the specified WriteThrottlePolicy
when the sessionScheduledWriteBytes,
sessionScheduledWriteMessages,
serviceScheduledWriteBytes or
serviceScheduledWriteMessages
exceeds the specified limit values.
Please add this filter at the end of the filter chain.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.apache.mina.common.IoFilter |
|---|
IoFilter.NextFilter |
| Constructor Summary | |
|---|---|
WriteThrottleFilter()
Creates a new instance with the default policy ( WriteThrottlePolicy.LOG) and limit values. |
|
WriteThrottleFilter(int maxSessionScheduledWriteMessages,
long maxSessionScheduledWriteBytes,
int maxServiceScheduledWriteMessages,
long maxServiceScheduledWriteBytes,
int maxGlobalScheduledWriteMessages,
long maxGlobalScheduledWriteBytes)
Creates a new instance with the default policy ( WriteThrottlePolicy.LOG) and the specified limit values. |
|
WriteThrottleFilter(WriteThrottlePolicy policy)
Creates a new instance with the specified policy and the default limit values. |
|
WriteThrottleFilter(WriteThrottlePolicy policy,
int maxSessionScheduledWriteMessages,
long maxSessionScheduledWriteBytes,
int maxServiceScheduledWriteMessages,
long maxServiceScheduledWriteBytes,
int maxGlobalScheduledWriteMessages,
long maxGlobalScheduledWriteBytes)
Creates a new instance with the specified policy and limit values. |
|
| Methods inherited from class org.apache.mina.common.IoFilterAdapter |
|---|
destroy, filterClose, filterSetTrafficMask, init, messageReceived, onPostAdd, onPostRemove, onPreRemove, sessionCreated, sessionIdle, sessionOpened |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public WriteThrottleFilter()
WriteThrottlePolicy.LOG) and limit values.
public WriteThrottleFilter(WriteThrottlePolicy policy)
public WriteThrottleFilter(int maxSessionScheduledWriteMessages,
long maxSessionScheduledWriteBytes,
int maxServiceScheduledWriteMessages,
long maxServiceScheduledWriteBytes,
int maxGlobalScheduledWriteMessages,
long maxGlobalScheduledWriteBytes)
WriteThrottlePolicy.LOG) and the specified limit values.
public WriteThrottleFilter(WriteThrottlePolicy policy,
int maxSessionScheduledWriteMessages,
long maxSessionScheduledWriteBytes,
int maxServiceScheduledWriteMessages,
long maxServiceScheduledWriteBytes,
int maxGlobalScheduledWriteMessages,
long maxGlobalScheduledWriteBytes)
| Method Detail |
|---|
public static int getGlobalScheduledWriteMessages()
public static long getGlobalScheduledWriteBytes()
public WriteThrottlePolicy getPolicy()
public void setPolicy(WriteThrottlePolicy policy)
public int getMaxSessionScheduledWriteMessages()
public void setMaxSessionScheduledWriteMessages(int maxSessionScheduledWriteMessages)
public long getMaxSessionScheduledWriteBytes()
public void setMaxSessionScheduledWriteBytes(long maxSessionScheduledWriteBytes)
public int getMaxServiceScheduledWriteMessages()
public void setMaxServiceScheduledWriteMessages(int maxServiceScheduledWriteMessages)
public long getMaxServiceScheduledWriteBytes()
public void setMaxServiceScheduledWriteBytes(long maxServiceScheduledWriteBytes)
public int getMaxGlobalScheduledWriteMessages()
public void setMaxGlobalScheduledWriteMessages(int maxGlobalScheduledWriteMessages)
public long getMaxGlobalScheduledWriteBytes()
public void setMaxGlobalScheduledWriteBytes(long maxGlobalScheduledWriteBytes)
public void onPreAdd(IoFilterChain parent,
String name,
IoFilter.NextFilter nextFilter)
throws Exception
IoFilterIoFilter.init() is invoked.
onPreAdd in interface IoFilteronPreAdd in class IoFilterAdapterparent - the parent who called this methodname - the name assigned to this filternextFilter - the IoFilter.NextFilter for this filter. You can reuse
this object until this filter is removed from the chain.
Exception
public void filterWrite(IoFilter.NextFilter nextFilter,
IoSession session,
WriteRequest writeRequest)
throws Exception
IoFilterIoSession.write(Object) method invocation.
filterWrite in interface IoFilterfilterWrite in class IoFilterAdapterException
public void messageSent(IoFilter.NextFilter nextFilter,
IoSession session,
WriteRequest writeRequest)
throws Exception
IoFilterIoHandler.messageSent(IoSession,Object)
event.
messageSent in interface IoFiltermessageSent in class IoFilterAdapterException
public void exceptionCaught(IoFilter.NextFilter nextFilter,
IoSession session,
Throwable cause)
throws Exception
IoFilterIoHandler.exceptionCaught(IoSession,Throwable)
event.
exceptionCaught in interface IoFilterexceptionCaught in class IoFilterAdapterException
public void sessionClosed(IoFilter.NextFilter nextFilter,
IoSession session)
throws Exception
IoFilterIoHandler.sessionClosed(IoSession) event.
sessionClosed in interface IoFiltersessionClosed in class IoFilterAdapterException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||