private HttpResponse getFromMesos(String uri, boolean useShortTimeout) {
HttpClient currentHttpClient = useShortTimeout ? shortTimeoutHttpClient : httpClient;
HttpResponse response = null;
final long start = System.currentTimeMillis();
LOG.debug("Fetching {} from mesos", uri);
try {
response = currentHttpClient.execute(HttpRequest.newBuilder().setUrl(uri).build(), new Options());
LOG.debug("Response {} - {} after {}", response.getStatusCode(), uri, JavaUtils.duration(start));
} catch (Exception e) {
throw new MesosClientException(String.format("Exception fetching %s after %s", uri, JavaUtils.duration(start)), e);
}
if (!response.isSuccess()) {
throw new MesosClientException(String.format("Invalid response code from %s : %s", uri, response.getStatusCode()));
}
return response;
}