AlreadyConnectedException when using netty for client connection

이희승 (Trustin Lee) trustin at gmail.com
Thu Sep 3 22:28:47 EDT 2009


Thanks for reporting this problem.  It should be fixed now. (i.e.
sendUpstream() is correct.)

Trustin

On Tue, 1 Sep 2009 20:46:17 +0900 (KST)
"Y. J. Chun" <monac3 at gmail.com> wrote:
> By the way,
> in the SimpleChannelUpstreamHandler source code, ChannelStateEvent is
> sent downstream by default. Is this correct?
> why sendDownstream() not sendUpstream()?
> 
> From line number 23 of  SimpleChannelUpstreamHandler.java of
> netty-3.1.2.GA case INTEREST_OPS:
>                 channelInterestChanged(ctx, evt);
>                 break;
>             default:
>                 ctx.sendDownstream(e);
>             }
>         } else if (e instanceof ExceptionEvent) {
> 
> 
> 
> On Tue, Sep 1, 2009 at 5:37 PM, Y. J. Chun<monac3 at gmail.com> wrote:
> > 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
> >>
> >
> 
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users



-- 
Trustin Lee, http://gleamynode.net/



More information about the netty-users mailing list