New to netty

Trustin Lee tlee at redhat.com
Mon Dec 8 05:18:58 EST 2008


On Mon, Dec 08, 2008 at 07:17:04PM +0900, Trustin Lee wrote:
> You are pretty close to prefection IMHO.  One left thing I can think of
> is to add an ExecutionHandler (org.jboss.netty.handler.execution) to the
> pipline.  By adding an ExecutionHandler which wraps a OrderedMemoryAware-
> ThreadPool (org.jboss.netty.handler.execution), you can make your
> handler to process the events in a different thread pool than the I/O
> thread pool.  Because you are performing a time-consuming task which
> might block the I/O thread, it is recommended to add an ExecutorHandler
> somewhere between the head of the pipeline and your handler that queries
> MySQL.
> 
> The following is a simple example that adds an ExecutorHandler as
> explained above:
> 
>   bootstrap.getPipeline().addLast("executor", new ExecutionHandler(
>       new MemoryAwareThreadPoolExecutor(16, 0, 0)));
>   bootstrap.getPipeline().addLast("handler", handler);

ExecutorHandler -> ExecutionHandler
 
-- 
Trustin Lee, Principal Software Engineer, JBoss, a division of Red Hat
--
what we call human nature in actuality is human habit
--
http://gleamynode.net/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/netty-users/attachments/20081208/2685e8d6/attachment.bin 


More information about the netty-users mailing list