@SuppressWarnings({"rawtypes", "unchecked"}) public void replayRequest(final NettyResponseFuture<?> future, FilterContext fc, Channel channel) { Request newRequest = fc.getRequest(); future.setAsyncHandler(fc.getAsyncHandler()); future.setChannelState(ChannelState.NEW); future.touch(); LOGGER.debug("\n\nReplaying Request {}\n for Future {}\n", newRequest, future); try { future.getAsyncHandler().onRetry(); } catch (Exception e) { LOGGER.error("onRetry crashed", e); abort(channel, future, e); return; } channelManager.drainChannelAndOffer(channel, future); sendNextRequest(newRequest, future); }
public boolean retry(NettyResponseFuture<?> future) { if (isClosed()) { return false; } if (future.isReplayPossible()) { future.setChannelState(ChannelState.RECONNECTED); LOGGER.debug("Trying to recover request {}\n", future.getNettyRequest().getHttpRequest()); try { future.getAsyncHandler().onRetry(); } catch (Exception e) { LOGGER.error("onRetry crashed", e); abort(future.channel(), future, e); return false; } try { sendNextRequest(future.getCurrentRequest(), future); return true; } catch (Exception e) { abort(future.channel(), future, e); return false; } } else { LOGGER.debug("Unable to recover future {}\n", future); return false; } }