You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Hanson Char <ha...@gmail.com> on 2006/07/26 03:54:10 UTC

ProtocolSession of ProtocolDecoder.decode thread-safe ?

>From the Mina FAQ, my understanding is that storing/retrieving resources
from a session is thread-safe in the IoHandler, as long as the resources are
not shared among sessions.

Is this also true for ProtocolDecoder ?  That is, is it true that
storing/retrieving resources from a session is thread-safe in the
ProtocolDecoder, as long as the resources are not shared among sessions ?

Thanks,
Hanson

Re: ProtocolSession of ProtocolDecoder.decode thread-safe ?

Posted by Trustin Lee <tr...@gmail.com>.
On 7/27/06, peter royal <pr...@apache.org> wrote:
>
> On Jul 25, 2006, at 9:54 PM, Hanson Char wrote:
> > From the Mina FAQ, my understanding is that storing/retrieving
> > resources
> > from a session is thread-safe in the IoHandler, as long as the
> > resources are
> > not shared among sessions.
>
> And the ThreadPoolFilter is used, yes.
>
> > Is this also true for ProtocolDecoder ?  That is, is it true that
> > storing/retrieving resources from a session is thread-safe in the
> > ProtocolDecoder, as long as the resources are not shared among
> > sessions ?
>
> As long as the ProtocolCodecFilter is in the chain after the
> ThreadPoolFilter (which would be the default), you'll be fine as well.


I think it should always be thread-safe even if we didn't use
ExecutorPoolFilter (formerly ThreadPoolFilter) unless you inserted a strange
filter that alters the thread model.  Am I missing something?

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

Re: ProtocolSession of ProtocolDecoder.decode thread-safe ?

Posted by peter royal <pr...@apache.org>.
On Jul 25, 2006, at 9:54 PM, Hanson Char wrote:
> From the Mina FAQ, my understanding is that storing/retrieving  
> resources
> from a session is thread-safe in the IoHandler, as long as the  
> resources are
> not shared among sessions.

And the ThreadPoolFilter is used, yes.

> Is this also true for ProtocolDecoder ?  That is, is it true that
> storing/retrieving resources from a session is thread-safe in the
> ProtocolDecoder, as long as the resources are not shared among  
> sessions ?

As long as the ProtocolCodecFilter is in the chain after the  
ThreadPoolFilter (which would be the default), you'll be fine as well.
-pete

-- 
(peter.royal|osi)@pobox.com - http://fotap.org/~osi