Multi-threaded Handling of UDP Messages

Simon James sjames at btisystems.com
Wed Sep 16 04:05:22 EDT 2009


Hi

I apologize if this is a dumb question!

I’ve implemented a simple UDP server along the lines of the QOTM example,
but using NioDatagramChannelFactory rather than OioDatagramChannelFactory,
namely:

        DatagramChannelFactory factory =
            new NioDatagramChannelFactory(Executors.newCachedThreadPool(),
10);

        ConnectionlessBootstrap bootstrap = new
ConnectionlessBootstrap(factory);
        ChannelPipeline p = bootstrap .getPipeline();
        // decoder/encoder omitted for clarity...
        p.addLast("handler", new ServerHandler());

        bootstrap .bind(new InetSocketAddress(1234));

This works OK, except that there is no multi-threading : all incoming
messages get handled by the same worker thread.
Using ConnectionLessBootstrap, is there a simple way to make it use multiple
threads in parallel?

Thanks

Simon

-- 
View this message in context: http://n2.nabble.com/Multi-threaded-Handling-of-UDP-Messages-tp3654751p3654751.html
Sent from the Netty User Group mailing list archive at Nabble.com.



More information about the netty-users mailing list