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
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, inputClosed, 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 Exception
IoFilter.NextFilterfor this filter. You can reuse this object until this filter is removed from the chain.
IoSessionwhich has to process this invocation
Exception- If an error occurred while processing the event
Copyright © 2004–2016 Apache MINA Project. All rights reserved.