private <T> T queryJobStatusServers(Function<String, String> requestUrlBuilder, TypeReference<T> typeReference) {
    SamzaException fetchException = null;
    for (String jobStatusServer : jobStatusServers) {
      String requestUrl = requestUrlBuilder.apply(jobStatusServer);
      try {
        ObjectMapper objectMapper = new ObjectMapper();
        byte[] response = httpGet(requestUrl);
        return objectMapper.readValue(response, typeReference);
      } catch (Exception e) {
        String exceptionMessage = String.format("Exception in http get request from url: %s.", requestUrl);
        LOG.error(exceptionMessage, e);
        fetchException = new SamzaException(exceptionMessage, e);
      }
    }
    throw fetchException;
  }
This method initiates http get request to the job status servers sequentially,
returns the first response from an job status server that returns a 2xx code(success response).
When a job status server is down or returns a error response, it tries to reach out to
the next job status server in the sequence, to complete the http get request.

@param requestUrlBuilder to build the request url, given job status server base url.
@param <T> return type of the http get response.
@return the response from any one of the job status server.
@throws Exception when all the job status servers are unavailable.
samza-rest/src/main/java/org/apache/samza/monitor/JobsClient.java