Emmanuel,
  Interesting, I find if I remove the ssl filter from the filter chain, it 
works fine, no wrong order message any more.
  any idea?

yang
----- Original Message -----
From: Emmanuel LŽcharny <[email protected]>
To: [email protected]
Sent: Mon, 7 Dec 2009 18:21:08 -0500 (EST)
Subject: Re: mina 1.1.7  sent wrong message order

Yang Li a écrit :
> Emmanuel,
>
>    Normally I'd agree, but as far as I can tell the write operation is fully 
> synchronized. That is, only one thread writes into each sessions at any given 
> time. 
No. If you have two incoming messages, you might have two outgoing write 
going on. The thing is that each 'atomic' write is enqueued on the 
IoProcessor, to be sent later. Here, each of your messageWrite() call 
will generate three messages.

What you can do is to create a single buffer and write it if you want to 
have all the messages in the correct order (but it's a bit of a hack)

> As such, shouldn't Mina send out the messages in order? 
It does. But order is kept by session.

Keep in mind that, as far as I can tell, I am using a single I/O 
processor thread (as mentioned in 
http://mina.apache.org/configuring-thread-model.html).

But there is an executor with a pool of thread created, so you have no 
guarantee that your second message can wait until the first one has been 
fully processed.

This problem has been solved in MINA 2.0, as we have 
http://mina.apache.org/report/trunk/apidocs/org/apache/mina/filter/executor/OrderedThreadPoolExecutor.html.

Reworking the protocol at this time is not really possible as we've 
already got clients in the wild.

May be switching to MINA 2.0.0-RC1 is an option then ...


Reply via email to