Search in sources :

Example 1 with IOExceptionFilter

use of org.asynchttpclient.filter.IOExceptionFilter in project async-http-client by AsyncHttpClient.

the class NettyRequestSender method applyIoExceptionFiltersAndReplayRequest.

public boolean applyIoExceptionFiltersAndReplayRequest(NettyResponseFuture<?> future, IOException e, Channel channel) {
    boolean replayed = false;
    @SuppressWarnings({ "unchecked", "rawtypes" }) FilterContext<?> fc = new FilterContext.FilterContextBuilder().asyncHandler(future.getAsyncHandler()).request(future.getCurrentRequest()).ioException(e).build();
    for (IOExceptionFilter asyncFilter : config.getIoExceptionFilters()) {
        try {
            fc = asyncFilter.filter(fc);
            assertNotNull(fc, "filterContext");
        } catch (FilterException efe) {
            abort(channel, future, efe);
        }
    }
    if (fc.replayRequest() && future.incrementRetryAndCheck() && future.isReplayPossible()) {
        replayRequest(future, fc, channel);
        replayed = true;
    }
    return replayed;
}
Also used : IOExceptionFilter(org.asynchttpclient.filter.IOExceptionFilter) FilterException(org.asynchttpclient.filter.FilterException)

Aggregations

FilterException (org.asynchttpclient.filter.FilterException)1 IOExceptionFilter (org.asynchttpclient.filter.IOExceptionFilter)1