From 7b7fd3f48be17b86d10062ce6f0f550a4f3a32ed Mon Sep 17 00:00:00 2001 From: Jeff Sabin Date: Tue, 14 Aug 2018 13:11:54 -0600 Subject: [PATCH] Fix for issue #67. Exposed the underlying Apache client in the constructor. --- src/main/java/org/kairosdb/client/HttpClient.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/kairosdb/client/HttpClient.java b/src/main/java/org/kairosdb/client/HttpClient.java index 720f449..1de12a9 100644 --- a/src/main/java/org/kairosdb/client/HttpClient.java +++ b/src/main/java/org/kairosdb/client/HttpClient.java @@ -106,13 +106,23 @@ public HttpClient(String url) throws MalformedURLException public HttpClient(HttpClientBuilder builder, String url) throws MalformedURLException { checkNotNullOrEmpty(url, "url cannot be null"); - checkNotNull(builder, "builder cannot be null"); + checkNotNull(builder, "builder must not be null"); this.url = url; new URL(url); // validate url client = builder.build(); typeRegistry = new DataPointTypeRegistry(); } + public HttpClient(CloseableHttpClient client, String url) throws MalformedURLException + { + checkNotNullOrEmpty(url, "url cannot be null"); + checkNotNull(client, "client must not be null"); + this.url = url; + new URL(url); // validate url + this.client = client; + typeRegistry = new DataPointTypeRegistry(); + } + public void registerCustomDataType(String groupType, Class dataPointClass) { checkNotNullOrEmpty(groupType, "groupType may not be null or empty");