public static <T> T request(RestTemplate restTemplate, String[] urls, HttpMethod method,
            String param, HttpHeaders header, Class<T> cls) throws Exception {
        ResponseEntity<String> exchange;
        Preconditions.expectNotNull(urls, ErrorCodeEnum.INVALID_PARAMETER, "url is blank");
        for (int i = 0; i < urls.length; i++) {
            try {
                HttpEntity<String> request = new HttpEntity<>(param, header);
                log.debug("send request to {}, param {}", urls[i], param);
                exchange = restTemplate.exchange(urls[i], method, request, String.class);
                String body = exchange.getBody();
                HttpStatus statusCode = exchange.getStatusCode();
                if (!statusCode.is2xxSuccessful()) {
                    log.error("request error for {}, status code {}, body {}", urls[i], statusCode, body);
                }

                log.debug("response from {}, status code {}", urls[i], statusCode);
                return GSON.fromJson(exchange.getBody(), cls);
            } catch (RestClientException e) {
                log.error("request for {}, error, begin retry", urls[i], e);
                if (i >= (urls.length - 1)) {
                    log.error("after retry, request for {} exception {} ", urls[i], e.getMessage());
                    throw e;
                }
            }
        }
        throw new Exception(String.format("send request to %s, params %s error", urls, param));
    }
Send an HTTP request by the given rest template.
inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/util/HttpUtils.java