Thanks Maarten.  I was trying to think of an eloquent way to say exactly that 
when I sent my reply.  I couldn't and then dropped it as 'obvious'.  I'm glad 
someone was able to state it better.

Rob

----- Original Message ----
From: Maarten Bosteels <[EMAIL PROTECTED]>
To: [email protected]
Sent: Thursday, August 30, 2007 11:21:54 AM
Subject: Re: ThreadLocal with Mina: ok or not?

On 8/30/07, Chris Winters <[EMAIL PROTECTED]> wrote:
>
>
> >> I'm a Mina newbie, so "the thread pool" he's discussing here is a
> little
> >> fuzzy, It seems from reading the "Configuring thread model" page
> >> (http://mina.apache.org/configuring-thread-model.html) that he's
> >> referencing
> >> an ExecutorFilter added to the IoFilterChain -- is that correct?
>
> > Yes.  Everything behind the ExecutorFilter (within the same request) can
> > safely use a ThreadLocal.
> > Sorry I wasn't more clear.



Of course, your code should not assume that two messageReceived events for
the same IoSession will be handled by the same thread.
So storing something in a threadlocal in the first messageReceived event and
trying to retrieve it in the second event is NOT safe.
(at least not in combination with an executorfilter)
But that's rather obvious, I guess.


Great, thanks for the clarification.
>
> BTW, integrating Mina into my existing networked application has been a
> snap. Hope to blog about this soon.
>
> Best wishes,
>
> Chris
> --
> View this message in context:
> http://www.nabble.com/ThreadLocal-with-Mina%3A-ok-or-not--tf4354098s16868.html#a12408585
> Sent from the Apache MINA Support Forum mailing list archive at Nabble.com
> .
>
>





       
____________________________________________________________________________________
Be a better Heartthrob. Get better relationship answers from someone who knows. 
Yahoo! Answers - Check it out. 
http://answers.yahoo.com/dir/?link=list&sid=396545433

Reply via email to