- private List<String> getDMaaPData() throws Exception {
- String response;
- CloseableHttpClient closeableHttpClient = null;
- HttpGet httpGet = new HttpGet(url + "/" + consumerGroup + "/" + consumer + "?timeout=" + period);
- try {
- closeableHttpClient = HttpsUtils.getHttpClient(timeout);
- HttpResponse httpResponse = HttpsUtils
- .get(httpGet, new HashMap<>(), closeableHttpClient);
- response = HttpsUtils.extractResponseEntity(httpResponse);
- } catch (Exception e) {
- throw e;
- } finally {
- httpGet.releaseConnection();
- if (closeableHttpClient != null) {
- try {
- closeableHttpClient.close();
- } catch (IOException e) {
- log.warn("Failed to close http client!");
- }
- }
- }
- return GsonUtil.jsonToBean(response, List.class);
+ private List<String> getDMaaPData() {
+ return JerseyClient.newInstance()
+ .path(consumerGroup)
+ .path(consumer)
+ .queryParam("timeout", period)
+ .get(url, List.class);