Question on channel listener.

19 views
Skip to first unread message

Ming

unread,
Jul 14, 2016, 11:29:31 PM7/14/16
to Netty discussions
Hi,

If a channel is first connected, and then add a listener, would it be possible that the listener could not capture the connected event? For example in HexDumpProxyFrontendHandler, what if a channel is connected (let's assume it is connected super fast) before the listener is added? 

@Override
    public void channelActive(ChannelHandlerContext ctx) {
        ...
        ChannelFuture f = b.connect(remoteHost, remotePort);
        outboundChannel = f.channel();
        f.addListener(new ChannelFutureListener() {
            @Override
            public void operationComplete(ChannelFuture future) {
                ...
            }
        }
    });
    }

Norman Maurer

unread,
Jul 14, 2016, 11:56:47 PM7/14/16
to ne...@googlegroups.com
If the future is complete before the listener is added it will still notify the listener once it is added.
--
You received this message because you are subscribed to the Google Groups "Netty discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netty+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/netty/54f46fd9-c6fb-474b-9721-d9f1cf803f2a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages