(SOLVED)Re: How to properly handle decoder chain in netty?

Frederic Bregier fredbregier at free.fr
Thu Jun 4 09:48:32 EDT 2009


As far as I understand Netty, "all" means that the handler instance is unique
and shared among
all channels, so a stateless handler.
"one" means the contrary, that is to say the handler instance is unique BY
channel and therefore not shared among all channels, so a statefull handler.
In a pipeline, you can mix "all" and "one" different handlers without any
problem.

In your case, the decoder handler is a statefull handler since it keeps the
previously received bytes that were not consumed by previous decode method
calls. So this one is a "one" statefull handler. There is in fact a variable
that should not be shared among different channels in your handler, you just
don't know it because it is in the implementation of the FrameDecoder which
masks it and simply show you the decode() method.

HTH,
Frederic


Jiang Bian wrote:
> 
> Frederic -
> Thanks, but I thought ChannelPipelineCoverage("all") means the handler is
> stateless or the member variable of the handler is designed to be shared.
> Since I don't have any member variable in the handler, it's stateless,
> isn't it?
> 
> Did I misunderstand the doc? 
> http://www.jboss.org/file-access/default/members/netty/freezone/api/3.0/org/jboss/netty/channel/ChannelPipelineCoverage.html
> 
> Thanks again for your help!
> 
> Jiang
> 


-----
Hardware/Software Architect
-- 
View this message in context: http://n2.nabble.com/How-to-properly-handle-decoder-chain-in-netty--tp3015408p3024813.html
Sent from the Netty User Group mailing list archive at Nabble.com.




More information about the netty-users mailing list