Handling heavy tasks in Netty

Albert Nikola albert.nikola at gmail.com
Wed May 18 14:31:38 EDT 2011


Hi Benoit,

Thank you for your response. Now I'm able to understand how to use
ExecutionHandler in ChannelPipelineFactory. However, I have another question
regarding pipeline. My server should receive byte array with length field
from remote client. In here I would expect to use
LengthFieldBasedFrameDecoder. However, from the next handler byte array
should be parsed and values should used to construct user defined java
object. We have encode/decode method that constructs byte array from Java
object (not serialization) and vise versa. Since, I'm new to Netty, I'm
confused. Anybody could give some hint how pipeline interception filter
should be used? Should I use those custom encode/decode methods as a custom
decoder/encoder? If then how that java object would be passed to next
business logic handler? Thank you.

 ChannelPipeline p = Channels.pipeline();
 p.addLast("framer", new LengthFieldBasedFrameDecoder(...));
 ......
 .....?
 .....
 p.addLast("businessLogic", new MyCustomHandler(...));

Albert

On Fri, May 13, 2011 at 1:34 AM, Benoit Perroud <benoit at noisette.ch> wrote:

> To handle heavy tasks (take long time to execute) you should add an
> ExecutionHandler in the pipeline. This will free the I/O workers and
> you will have a dedicated ThreadPool that you can fine tune to execute
> your heavy tasks, just like in SEDA
> (http://en.wikipedia.org/wiki/Staged_event-driven_architecture)
>
>
>
> 2011/5/13 Albert Nikola <albert.nikola at gmail.com>:
> > Hi All,
> >
> > I'm fairly new to Java and my research led me to Netty. I read that Netty
> > uses same design pattern with MINA and xSocket. Does this mean the Netty
> is
> > complete reactor pattern NIO framework and is concurrency and
> > synchronization issue in threading already taken care of? I'm wondering
> that
> > if the task to process message is heavy then how should I handle this?
> > Please help me to get enlightened. Thanks.
> >
> > Albert
> >
> > _______________________________________________
> > netty-users mailing list
> > netty-users at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/netty-users
> >
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/netty-users/attachments/20110518/715e46ec/attachment.html 


More information about the netty-users mailing list