Interesting. Could you instead add a listener on the future returned from writeAndFlush?
Can you share the stacktrace of the NPE? close should be idempotent or at least throw a more specific exception. On Thu, Oct 20, 2016 at 10:23 AM, Jonathan <[email protected]> wrote: > Hi all ! > > I had kind of a bug today with : > > ChannelHandlerContext.writeAndFlush(Object, ChannelPromise). > > Indeed I had some listeners on my promise, one of them being : > > promise.addListener(ChannelFutureListener.CLOSE); > > > The problem I encountered is that the promise is completed as soon as the > WRITE is done, not after the FLUSH operation. So when it comes to the flush > my channel is closed and I have a NPE... > > My question is : Am I doing something wrong, or should the promise be > completed AFTER the flush ? > > Besides, if I call > > ChannelHandlerContext.write(Object, ChannelPromise). > > it makes sense for the promise to be completed after the write, but with > writeAndFlush I expected it to be completed and the flush. > > > > Thanks before for your help, and keep the good work :) > > Jonathan > > -- > 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 [email protected]. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/netty/ec9374c8-6616-43dc-9fb6-0ec540687e0c%40googlegroups.com > <https://groups.google.com/d/msgid/netty/ec9374c8-6616-43dc-9fb6-0ec540687e0c%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/netty/CA%2B%3DgZKDjfy7YeNiTayAtUeh4mD8sBpoDWtAN0%3Duqh3PMw6tpmA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
