ClosedChannelException thrown when stopping Channel

neilson9 neil at liquidlabs.co.uk
Wed Jul 8 08:21:25 EDT 2009


Hi,
In my connection pool Im invalidating and closing connections when they are
no longer needed (i.e. pools hightwater mark is reached) and I seem to get
many ClosedChannelExceptions. Looking at the Stack and the Source Code
[below] it looks like I will either get a NotYetConnectedException OR a
ClosedChannelException - when stopping a channel.

Is it possible to prevent this from happening? 
Regards Neil.

>From NioWorker.cleanUpWriteBuffer
             // Create the exception only once to avoid the excessive
overhead
                // caused by fillStackTrace.
                if (channel.isOpen()) {
                    cause = new NotYetConnectedException();
                } else {
                    cause = new ClosedChannelException();
                }
                evt.getFuture().setFailure(cause);

                fireExceptionCaught(channel, cause);

The exception picked up by my Handler
2009-07-08 13:10:16,272 WARN 3:10000-10-10 (netty.NettyClientHandler)	
com.liquidlabs.transport.netty.NettyClientHandler at 3f84e8 m:null
Client[null]] Unexpected exception from downstream, latch[null]
java.nio.channels.ClosedChannelException
	at
org.jboss.netty.channel.socket.nio.NioWorker.cleanUpWriteBuffer(NioWorker.java:609)
	at org.jboss.netty.channel.socket.nio.NioWorker.close(NioWorker.java:568)
	at
org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink.eventSunk(NioClientSocketPipelineSink.java:97)
	at org.jboss.netty.channel.Channels.close(Channels.java:1043)
	at org.jboss.netty.channel.AbstractChannel.close(AbstractChannel.java:185)
	at com.ll.transport.netty.NettySenderImpl.stop(NettySenderImpl.java:118)


-- 
View this message in context: http://n2.nabble.com/ClosedChannelException-thrown-when-stopping-Channel-tp3225111p3225111.html
Sent from the Netty User Group mailing list archive at Nabble.com.



More information about the netty-users mailing list