You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Rob Butler <cr...@yahoo.com> on 2007/05/29 18:44:39 UTC

Message lifecycle

Hello all,

Hopefully just a quick question here.  I'd really appreciate a quick response.

For TCP connections, Mina processes bytes from the wire in order.  But how are things handled by the IoHandler and session.write()?

Here's the scenario...

I have a protocol codec, an executor filter and an IoHandler.  Let's also say that two messages are sent down the connection.  The protocol codec parses the first message from the wire and calls out.write, and then does the same for the second message.

Will message 1 be processed to completion (return from the IoHandler.messageRecieved call) before message 2 processing begins or will both of these messages be processed simultaneously?  Assume it takes a long time to process the messages so processing message 1 will not be completed before message 2 has arrived.

Does Mina by default do anything to guarantee message ordering?  I.E. if message 2's processing completes before message 1 will it be sent on the wire first, or does Mina wait and send message 1's output first?

I suspect the answers are the messages will be processed simultaneously and Mina doesn't enforce message ordering.  At least I hope that's what the answers are.

Is there any existing code in Mina to support in-order message processing, or in-order messsage return if a particular protocol needs it?  I don't need it at the moment, but I may want to implement some protocols in the future that do.  I'm sure others will need that at some time too, so it would be nice if it were supplied by the framework.

Thanks
Rob






       
____________________________________________________________________________________Sick sense of humor? Visit Yahoo! TV's 
Comedy with an Edge to see what's on, when. 
http://tv.yahoo.com/collections/222