[Opening an old thread.....]
What is the best practice here? I am assuming that invoking writeAndFlush() from a channelHandler is good (following example) :
public class MyStreamHandler extends ChannelInboundHandlerAdapter {
//Some code
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
//some code
final ChannelFuture future = this.channel.writeAndFlush(content);
future.addListener(new WriteCompleteListener(..);
//some other code
}
}
Or invoking writeAndFlush from outside the EventLoop is the best practice? I am little confused.
Thanks,
Arnab