Thank you very much, Trustin.
> -----Original Message----- > From: Trustin Lee [mailto:[EMAIL PROTECTED] > Sent: Thursday, November 23, 2006 2:46 PM > To: [email protected] > Subject: Re: [mina] ACK protocol????? > > On 11/23/06, Hieu Phan Thanh <[EMAIL PROTECTED]> wrote: > > > > Hi Trustin, > > > > > There's possibility that the ACK is sent over the socket before the > > > 'messageReceived' event is fired. It's not always going to be like > > that > > > because write operation is also asynchronous. But there's possibility > > > definitely. Once your decoder calls ProtocolDecoderOutput.write() and > > > returns, then 'messageReceived' event is propagated to the next filter > > and > > > finally the IoHandler. If you are writing in the middle of the chain > > > (decode() in this case), then the write operation can be performed > > before > > > 'messageReceived' event is fired, but 'messageSent' event for the > > write > > > operation will arrive after the 'messageReceived' event. > > > > > My design is: server will send ACK before processing logic at > > 'messageRecieved' event. In other words, while server is processing the > > message, the client could send another message. > > > Yep, I know it. > > My app has only 'codec' filter and finally with IoHandler. > > I call 'IoSession.wite(ACK)' before the ' ProtocolDecoderOutput.write()' > > in 'MessageDecoder.decode()'. > > I want to make sure that the ACK message will be sent before the > > 'messageReceived' is fired. > > Based on your explanation, that means the ACK message is actually sent > > over the socket after the 'messageReceived' is done. Am I correct? > > > No. My explanation is saying that messageSent event is fired after > messageReceived. The acutal write operation can occur before > IoHandler.messageReceived is invoked, as I stated earlier explanation. > > Trustin > -- > what we call human nature is actually human habit > -- > http://gleamynode.net/ > -- > PGP key fingerprints: > * E167 E6AF E73A CBCE EE41 4A29 544D DE48 FE95 4E7E > * B693 628E 6047 4F8F CFA4 455E 1C62 A7DC 0255 ECA6
