Le 11/28/12 9:52 PM, David R Robison a écrit :
> The second. I have a TCP session to a client and I am seeing writes pile 
> up in the queue. If I cannot write a message in 500ms then, if it hasn't 
> started writing, then I want to remove it from the queue and cancel the 
> write request.

There is a much better way to do that.

MINA is asynchronous, and is based on an event system. When you write a
message to a client, when the message has been completely written (I
mean, pushed into the socket), then a MessageSent event will be
generated. Your handler can process this MessageSent event, and push the
next message. If the delay is too long between two writes - and you can
handle this delay by using the Idle event - then you can discard the
messages.

This way, you don't have to push messages into any queue.


-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com 

Reply via email to