throw (lastException == null)
? new OnlyBadHostsException()
: new OnlyBadHostsException(lastException);
}
ServiceEndPoint endPoint = chooseEndPoint(validEndPoints, partitionContext);
if (endPoint == null) {
throw (lastException == null)
? new NoSuitableHostsException()
: new NoSuitableHostsException(lastException);
}
try {
R result = executeOnEndPoint(endPoint, callback);
_numExecuteSuccesses.mark();
return result;
} catch (Exception e) {
_numExecuteAttemptFailures.mark();
// Don't retry if exception is too severe.
if (!isRetriableException(e)) {
throw Throwables.propagate(e);
}
LOG.info("Retriable exception from end point id: {}, {}", endPoint.getId(), e.toString());
LOG.debug("Exception", e);
lastException = e;
}
} while (retry.allowRetry(++numAttempts, sw.elapsed(TimeUnit.MILLISECONDS)));