1 package org.openecomp.sdc.common.http.client.api;
3 import org.apache.http.protocol.HttpContext;
4 import org.openecomp.sdc.common.log.wrappers.Logger;
6 import java.io.IOException;
8 public class RetryHandlers {
10 private static final Logger logger = Logger.getLogger(RetryHandlers.class.getName());
12 private RetryHandlers(){}
14 public static ComparableHttpRequestRetryHandler getDefault(int numOfRetries) {
15 return (IOException exception, int executionCount, HttpContext context) -> {
16 logger.debug("failed sending request with exception", exception);
17 logger.debug("try request number: {}", executionCount);
18 return executionCount <= numOfRetries;