Cancelling a time out event
Marc-André Laverdière
marcandre.laverdiere at gmail.com
Mon Nov 1 03:11:56 EDT 2010
Hello everyone,
I have a pipeline with a timeout handler. Now, it happens that the
timeout event gets triggered while the processing is happening. This
is what I hacked into place into my main handler:
@Override
public void closeRequested(ChannelHandlerContext ctx,
ChannelStateEvent e) throws Exception {
//Don't let operations time out in the middle of request processing
//This is a downstream event, so we can cancel its Future
if (isHandlingRequest.get()) {
e.getFuture().cancel();
logger.trace("Cancelled close request because we are in the middle
of processing something");
} else super.closeRequested(ctx, e);
}
Is this the right way to handle this? Is this creating extraneous
processing that could hurt performance?
Thanks and regards,
Marc-André LAVERDIÈRE
"Perseverance must finish its work so that you may be mature and
complete, not lacking anything." -James 1:4
http://asimplediscipleslife.blogspot.com/
mlaverd.theunixplace.com
More information about the netty-users
mailing list