diff options
author | Shiwei Tian <tian.shiwei@zte.com.cn> | 2018-04-16 16:59:14 +0800 |
---|---|---|
committer | Shiwei Tian <tian.shiwei@zte.com.cn> | 2018-04-16 16:59:14 +0800 |
commit | 60604fc38e3e1547c8fbec3378a9f38eb9f2896f (patch) | |
tree | eb77281eabe023b614ffd88d34e37508a9ae17fe /dmaap-dsa/src/main/java/org | |
parent | bfe7264117cdcf6aa570db8643676e73a7158ef0 (diff) |
fix https timeout get connection
Issue-ID: HOLMES-104
Change-Id: If76dcc6be77f698820fe4c7b9ae4f1d28f75e4c2
Signed-off-by: Shiwei Tian <tian.shiwei@zte.com.cn>
Diffstat (limited to 'dmaap-dsa/src/main/java/org')
-rw-r--r-- | dmaap-dsa/src/main/java/org/onap/holmes/dsa/dmaappolling/Subscriber.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/dmaap-dsa/src/main/java/org/onap/holmes/dsa/dmaappolling/Subscriber.java b/dmaap-dsa/src/main/java/org/onap/holmes/dsa/dmaappolling/Subscriber.java index d696dee..16ddc15 100644 --- a/dmaap-dsa/src/main/java/org/onap/holmes/dsa/dmaappolling/Subscriber.java +++ b/dmaap-dsa/src/main/java/org/onap/holmes/dsa/dmaappolling/Subscriber.java @@ -26,6 +26,7 @@ import lombok.Getter; import lombok.Setter; import lombok.extern.slf4j.Slf4j; import org.apache.http.HttpResponse; +import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; import org.onap.holmes.common.api.stat.VesAlarm; import org.onap.holmes.common.dropwizard.ioc.utils.ServiceLocatorHolder; @@ -84,14 +85,16 @@ public class Subscriber { private List<String> getDMaaPData() throws Exception { String response; CloseableHttpClient closeableHttpClient = null; + HttpGet httpGet = new HttpGet(url + "/" + consumerGroup + "/" + consumer); try { closeableHttpClient = HttpsUtils.getHttpClient(timeout); HttpResponse httpResponse = HttpsUtils - .get(url + "/" + consumerGroup + "/" + consumer, new HashMap<>(), closeableHttpClient); + .get(httpGet, new HashMap<>(), closeableHttpClient); response = HttpsUtils.extractResponseEntity(httpResponse); } catch (Exception e) { throw e; } finally { + httpGet.releaseConnection(); if (closeableHttpClient != null) { try { closeableHttpClient.close(); |