public static Object backoffAndRetry()

in src/main/java/org/apache/doris/kafka/connector/utils/BackoffAndRetryUtils.java [47:67]


    public static Object backoffAndRetry(
            final LoadOperation operation, final BackoffFunction runnable) throws Exception {
        for (final int iteration : backoffSec) {
            if (iteration != 0) {
                Thread.sleep(iteration * 1000L);
                LOG.debug("Retry Count:{} for operation:{}", iteration, operation);
            }
            try {
                return runnable.apply();
            } catch (Exception e) {
                LOG.error(
                        "Retry count:{} caught an exception for operation:{} with message:{}",
                        iteration,
                        operation,
                        e.getMessage());
            }
        }
        String errMsg = "Api retry exceeded the max retry limit, operation = " + operation;
        LOG.error(errMsg);
        throw new DorisException(errMsg);
    }