@Override
public void handle(final Channel channel, final NettyResponseFuture<?> future, final Object e) throws Exception {
future.touch();
if (future.isDone()) {
channelManager.closeChannel(channel);
return;
}
AsyncHandler<?> handler = future.getAsyncHandler();
try {
if (e instanceof HttpResponse && handleHttpResponse((HttpResponse) e, channel, future, handler))
return;
if (e instanceof HttpChunk)
handleChunk((HttpChunk) e, channel, future, handler);
} catch (Exception t) {
if (hasIOExceptionFilters
&& t instanceof IOException
&& requestSender.applyIoExceptionFiltersAndReplayRequest(future, IOException.class.cast(t), channel)) {
return;
}
try {
requestSender.abort(future, t);
} catch (Exception abortException) {
logger.debug("Abort failed", abortException);
} finally {
finishUpdate(future, channel, false);
}
throw t;
}
}