public class WriteRequestFilter extends IoFilterAdapter
WriteRequestqueue to provide accurate write queue status tracking.
The biggest difference from
UnorderedThreadPoolExecutor is that
is invoked when the write operation is completed by an
consequently providing the accurate tracking of the write request queue
status to the
Most common usage of this filter could be detecting an
which writes too fast which will cause
session.getFilterChain().addLast( "writeThrottle", new WriteRequestFilter(new IoEventQueueThrottle()));
IoEventQueueHandlerimplementation such as
IoProcessorthread. It's because an
IoProcessorthread is what processes the
WriteRequests and notifies related
IoEventQueueHandlerimplementation that waits for the size of the write request queue to decrease will never wake up. To use such an handler, you have to insert an
ExecutorFilterbefore this filter or call
IoSession.write(Object)method always from a different thread.
|Constructor and Description|
Creates a new instance with a new default
Creates a new instance with the specified
|Modifier and Type||Method and Description|
destroy, exceptionCaught, filterClose, init, messageReceived, messageSent, onPostAdd, onPostRemove, onPreAdd, onPreRemove, sessionClosed, sessionCreated, sessionIdle, sessionOpened, toString
public IoEventQueueHandler getQueueHandler()
IoEventQueueHandlerwhich is attached to this filter.
public void filterWrite(IoFilter.NextFilter nextFilter, IoSession session, WriteRequest writeRequest) throws java.lang.Exception
Copyright © 2004-2019 Apache MINA Project. All Rights Reserved.