cicada icon indicating copy to clipboard operation
cicada copied to clipboard

Is it better to use ChannelFutureListener at the end of HttpDispatcher

Open xyg-coder opened this issue 4 years ago • 2 comments

Hi, in your code HttpDispatcher:105, is it better to put the cleaning code to the ChannelFutureListener of ctx.writeAndFlush(response);?

xyg-coder avatar Mar 16 '20 06:03 xyg-coder

future = ctx.writeAndFlush(response);
if (future.isSuccess()) {
    CicadaContext.removeContext();
}

do you mean this?

crossoverJie avatar Mar 30 '20 06:03 crossoverJie

ctx.writeAndFlush(response).addListeners(new Cleaner());

Cleaner will implement ChannelFutureListener

xyg-coder avatar Apr 03 '20 06:04 xyg-coder