A couple of questions about Netty internals

Trustin Lee (이희승) trustin at gmail.com
Tue Nov 3 04:23:13 EST 2009


Thanks for your interest in Netty, but please do not double-post.
Your second duplicate post has been discarded.

On Mon, Nov 2, 2009 at 3:44 PM, Mert İnan <inanme at yahoo.com> wrote:
>
> Hi Netty Developer Group,
>
> i am trying to get confortable with Netty(3.1.5). Here are a couple of
> questions i come up with.
>
> 1. Data comes into netty, it goes up and down through handlers. There may be
> many ChannelUpstreamHandler and ChannelDownstreamHandler handlers. In all
> those handlers,in general, should i use Channels.fireMessageReceived only
> once? if so when? what happens if Channels.fireMessageReceived is called
> more then once in up handlers?

There's no restriction on how many times an event should be generated
by a handler.  This means, you can generate as many as events as you
want

> 2. What should i do when my decoder constructed by more than one handler? Is
> it required that Decoder must be implemented in one handler?

You can write a complex decoder with more than one handler.  That is,
you can combine multiple decoders to decode multi-layered protocols
for example.

> 3. Why FrameDecoder.callDecode throws this Exception?
>
>                throw new IllegalStateException(
>                        "decode() method must read at least one byte " +
>                        "if it returned a frame (caused by: " + getClass() +
> ")");

Decoding, by definition, reads something from the input and produces
the decoded data.  Therefore, you cannot create something from
nothing.

HTH

— Trustin Lee, http://gleamynode.net/



More information about the netty-dev mailing list