Handshake complete listener
andrrei
andrei.grigoruta at yahoo.com
Fri Sep 2 03:10:22 EDT 2011
Hello,
I have a question. Giving the code below:
public class ConnectionHandler extends SimpleChannelUpstreamHandler {
@Override
public void channelConnected(ChannelHandlerContext ctx,
ChannelStateEvent e) throws Exception {
................
ChannelFuture channelFuture = sslHandler.handshake();
channelFuture.addListener(new HandshakeListener());
................
}
@Override
public void messageReceived(ChannelHandlerContext ctx,
MessageEvent e) throws Exception {
..................
}
private class HandshakeListener implements ChannelFutureListener {
@Override
public void operationComplete(ChannelFuture future) throws Exception {
.....................
}
}
}
The code from HandshakeListener.operationComplete(ChanelFuture) will always
be executed before receiving a message on
ConnectionHandler.messageReceived(ChannelHandlerContext, MessageEvent) ? I'm
asking this because I noticed that 90% of the time this is true. But 10% of
the time I receive messages before the code from
operationComplete(ChanelFuture) gets executed. Is this a bug or is this the
normal behavior and I should synchronize those 2 blocks of code?
--
View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Handshake-complete-listener-tp6752939p6752939.html
Sent from the Netty User Group mailing list archive at Nabble.com.
More information about the netty-users
mailing list