Trouble understanding the handler pipeline

Utkarsh Srivastava utkarsh at gmail.com
Tue Mar 10 17:30:43 EDT 2009


Hi,

I am a day old to netty and still finding my way around. Looks like a really
slick framework!

I am having a little trouble understanding the handler pipeline (yes, I have
read the api docs for ChannelPipeline, ChannelHandler and ChannelEvent). To
take a concrete example, the server pipeline in the example time server has
the following pipeline:

        ChannelPipeline p = pipeline();
        1. p.addLast("frameDecoder", new
LengthFieldBasedFrameDecoder(1048576, 0, 4, 0, 4));
        2. p.addLast("protobufDecoder", new
ProtobufDecoder(LocalTimeProtocol.Locations.getDefaultInstance()));

        3. p.addLast("frameEncoder", new LengthFieldPrepender(4));
        4. p.addLast("protobufEncoder", new ProtobufEncoder());

        5. p.addLast("handler", new LocalTimeServerHandler());
        return p;

For a given request, handlers are executed in the order 1,2,5,4,3, right?
Thats the only order that makes sense.

But thats totally different from the order they are added to the pipeline in
the code.

Utkarsh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/netty-users/attachments/20090310/c7ab7b7f/attachment.html 


More information about the netty-users mailing list