/** * Pass any caught exceptions here * * @param exception the exception * @throws Exception if not retry-able or the retry policy returned negative */ public void takeException(Exception exception) { bool rethrow = true; if (isRetryException(exception)) { log.Debug(exception, "Retry-able exception received"); long elapsedTimeMs = (DateTime.Now.Ticks - startTimeMs) / 1000; if (retryPolicy.allowRetry(retryCount++, elapsedTimeMs, sleeper)) { tracer.Get().addCount("retries-allowed", 1); log.Debug("Retrying operation"); rethrow = false; } else { tracer.Get().addCount("retries-disallowed", 1); log.Debug("Retry policy not allowing retry"); } } if (rethrow) { throw exception; } }