In which thread the exception will be notified.

klmr57 maheshwaraokl at ivycomptech.com
Tue Aug 17 08:37:46 EDT 2010


Hi,
My client code is like below.

ChannelFactory factory = new NioClientSocketChannelFactory(Executors
                .newCachedThreadPool(), Executors.newCachedThreadPool(), 
                Runtime.getRuntime().availableProcessors() * 2 + 1);
     
        ClientBootstrap bootstrap = new ClientBootstrap(factory);
     
        channelGroup = new DefaultChannelGroup("EDS");
     
        
        NettyClientHandler handler = new NettyClientHandler();
        
        //decoders to support 1MB data for now. if want, can be increased.
        //They throw StreamCorruptedException if bigger objects of >1MB is
received.
        
        //TODO: We can also use custom class loader in constructor. use this
feature 
        //in OSGI environment. 
        bootstrap.getPipeline().addLast("decoder", new ObjectDecoder());
        bootstrap.getPipeline().addLast("encoder", new ObjectEncoder());
        bootstrap.getPipeline().addLast("handler", handler);
        bootstrap.setOption("tcpNoDelay", true);
        bootstrap.setOption("keepAlive", true);
        bootstrap.setOption("reuseAddress", true);
        bootstrap.setOption("connectTimeoutMillis", 100);
 
        Channel channel = bootstrap.connect(new InetSocketAddress(host,
port))
                .awaitUninterruptibly().getChannel();
        channelGroup.add(channel);


I have only 3 handlers in pipe line. so methods like exceptionCaught etc
will be invoked from same caller thread which performed Channels.write()
method?
-- 
View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/In-which-thread-the-exception-will-be-notified-tp5431875p5431875.html
Sent from the Netty User Group mailing list archive at Nabble.com.


More information about the netty-users mailing list