You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by James Im <im...@hotmail.com> on 2007/01/11 18:11:32 UTC

about TextLineDecoder's ByteBuffer initialization

I'm looking at TextLineDecoder (in mina 1.0.1) and I see that
"ByteBuffer delimBuf" is initialized on demand. I'm wondering is this is
a thread safe initialization.

If the method decodeNormal(...) can be called by 2 threads at the same
time, I think that their could be some visibility problems. In that case
I guess that the delimBuf could be assigned twice or more times.

What do you think?

_________________________________________________________________
Download din yndlingsmusik pĺ MSN Music:  http://www.msn.dk/music  - det er 
nemt og billigt


Re: about TextLineDecoder's ByteBuffer initialization

Posted by Trustin Lee <tr...@gmail.com>.
On 1/12/07, James Im <im...@hotmail.com> wrote:
>
> I'm looking at TextLineDecoder (in mina 1.0.1) and I see that
> "ByteBuffer delimBuf" is initialized on demand. I'm wondering is this is
> a thread safe initialization.
>
> If the method decodeNormal(...) can be called by 2 threads at the same
> time, I think that their could be some visibility problems. In that case
> I guess that the delimBuf could be assigned twice or more times.


decoder is invoked serially, so it shouldn't be a problem, unless you
inserted a filter that doesn't maintain the order of events.

HTH,
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