use of io.github.resilience4j.core.IntervalFunction in project java-chassis by ServiceComb.
the class RetryHandler method getRetry.
private Retry getRetry(RetryPolicy retryPolicy) {
LOGGER.info("applying new policy: {}", retryPolicy.toString());
RetryConfig config = RetryConfig.custom().maxAttempts(retryPolicy.getMaxAttempts() + 1).retryOnResult(response -> retryExtension.isRetry(retryPolicy.getRetryOnResponseStatus(), response)).retryOnException(e -> retryExtension.isRetry(e)).intervalFunction(getIntervalFunction(retryPolicy)).build();
RetryRegistry registry = RetryRegistry.of(config);
return registry.retry(retryPolicy.getName());
}
Aggregations