Le 12/13/12 12:31 AM, Jon V a écrit :
> I wrote "monotomic" which is a mis-spelling (lets blame it on the 
> auto-correction in Mac OSX) for "monotonic".  Monotonic, by nature means that 
> an ordering mechanism must always be progressing forward and in 
> order.(guaranteed order) e.g. 1,2,3,4,5
>
> I will expand on my second question.
>
> 1. Lets say that there are 4 polling threads and one session.
There is nothing such a polling mechanism in MINA, even if the 'polling'
name is (wrongly) used ot name some MINA classes. MINA is always waked
up by some incoming event, like some data being received, or the socket
being ready for new data to be written in, or some new connecting
request being received, etc.

This is imôrtant to understand this aspect.

Another important aspect is that once a session is created, it's always,
I mean *always*, handled by the same IoProcessor thread. You should
consider that there is no way a single session cn be processed by two
different threads, unless you have added an Executor in your filter chain.
>
> 2. Mina fires off messageReceived #1 during one polling cycle.  Protocol 
> chain is executing.
Let's translate that to :

Mina fires off a messageReceived event when some data are read from the
socket *and* the IoProcessor thread is available to read those data.

In this case, the thread execute as much as it can, ie if not engough
information is available to produce a full message in your decoder, then
your decoder should accumulate the received data and state, and return.
>
> 3. Another polling cycle comes around, the session has new information in the 
> buffer.
Ok
>
> 4. Will Mina fire off the new buffer while the previous cycle is still 
> executing? 

No, again, the previous cycle is already terminated. Again, unless you
have added an executor in the chain.

>  say it takes longer than the polling cycle to complete processing of the 
> data.  
Not possible under any condition.

> Since my protocol is single threaded, do I need to make it aware of multi 
> threaded attempts to invoke it? 
No. But kep in mind that if your decoder store some data, then it won't
work : the decoder is shared by all the session.

Bottom line, make you decoder stateless, and store it's state in the
session.


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

Reply via email to