AlreadyConnectedException when using netty for client connection

Y. J. Chun monac3 at gmail.com
Tue Sep 1 04:37:04 EDT 2009


Yep. I was calling ctx.sendDownstream(e) except when the state is CONNECTED.
I thought calling sendDownstream() was the default behavior of
SimpleChannelUpstreamHandler.
I modified it to not calling sendDownstream() for all known state and
I see no more exception.
Thanks for the help.


On Tue, Sep 1, 2009 at 2:20 PM, 이희승<trustin at gmail.com> wrote:
> Hello YJ
>
> I want to know what you do in your handler code.  I guess you are
> trying to call Channel.bind() on a Channel which is connected and hence
> bound already.
>
> Trustin
>
> On Mon, 31 Aug 2009 20:23:33 +0900 (KST)
> "Y. J. Chun" <monac3 at gmail.com> wrote:
>> Hello.
>>
>> I'm using netty to connect to remote server. The connection is
>> established successfully. But handleUpstream() receives ExceptionEvent
>> which is java.nio.channels.AlreadyConnectedException. Not sure if
>> affects the channel in one way or another because connection seems to
>> be processed without problem. Please tell me if this is normal or
>> something is wrong.
>>
>> Exception message is following.
>> java.nio.channels.AlreadyConnectedException: null
>>       at
>> sun.nio.ch.SocketChannelImpl.ensureOpenAndUnconnected(SocketChannelImpl.java:474)
>> [na:1.6.0_16] at
>> sun.nio.ch.SocketChannelImpl.bind(SocketChannelImpl.java:446)
>> [na:1.6.0_16] at
>> sun.nio.ch.SocketAdaptor.bind(SocketAdaptor.java:132) [na:1.6.0_16]
>> at
>> org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink.bind(NioClientSocketPipelineSink.java:131)
>> [netty-3.1.0.GA.jar:na] at
>> org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink.eventSunk(NioClientSocketPipelineSink.java:102)
>> [netty-3.1.0.GA.jar:na] at <DELETING:My class name> [classes/:na] at
>> org.jboss.netty.channel.Channels.fireChannelBound(Channels.java:239)
>> [netty-3.1.0.GA.jar:na] at
>> org.jboss.netty.channel.socket.nio.NioWorker$RegisterTask.run(NioWorker.java:760)
>> [netty-3.1.0.GA.jar:na] at
>> org.jboss.netty.channel.socket.nio.NioWorker.processRegisterTaskQueue(NioWorker.java:260)
>> [netty-3.1.0.GA.jar:na] at
>> org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:199)
>> [netty-3.1.0.GA.jar:na] at
>> org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:53)
>> [netty-3.1.0.GA.jar:na] at
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>> [na:1.6.0_16] at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>> [na:1.6.0_16] at java.lang.Thread.run(Thread.java:619) [na:1.6.0_16]
>>
>> channel was created by following bootstrap
>>               bootstrap = new ClientBootstrap(
>>                               new
>> NioClientSocketChannelFactory(Executors       .newCachedThreadPool() ,
>> Executors.newCachedThreadPool()));
>>               bootstrap.getPipeline().addLast("handler", this);
>>
>>
>> Thanks.
>> _______________________________________________
>> netty-users mailing list
>> netty-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/netty-users
>
>
>
> --
> Trustin Lee, http://gleamynode.net/
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users
>



More information about the netty-users mailing list