HttpResponse response = null; for (int attempt = 1; attempt <= numAttempts; ++attempt) { entry.withAttempt(attempt); try { response = sendImpl();
HttpResponse response = null; for (int attempt = 1; attempt <= numAttempts; ++attempt) { entry.withAttempt(attempt); try { response = sendImpl();
@Override public Observable<? extends HttpClientResponse<ByteBuf>> call(Throwable throwable) { final boolean retryReadTimeouts = context.config().retryReadTimeouts(); if (throwable instanceof ConnectException || throwable instanceof ReadTimeoutException && retryReadTimeouts) { context.entry().withAttempt(attempt); return context.rxHttp().execute(context); } return Observable.error(throwable); } }
@Override public Observable<HttpClientResponse<ByteBuf>> call(HttpClientResponse<ByteBuf> res) { final int code = res.getStatus().code(); Observable<HttpClientResponse<ByteBuf>> resObs; if (code == 429 || code == 503) { final long retryDelay = getRetryDelay(res, delay); res.getContent().subscribe(); context.entry().withAttempt(attempt); resObs = context.rxHttp().execute(context); if (retryDelay > 0) { resObs = resObs.delaySubscription(retryDelay, TimeUnit.MILLISECONDS); } } else if (code >= 500) { res.getContent().subscribe(); context.entry().withAttempt(attempt); resObs = context.rxHttp().execute(context); } else { resObs = Observable.just(res); } return resObs; } }