Skip to content

Commit 7b7fd3f

Browse files
author
Jeff Sabin
committed
Fix for issue #67. Exposed the underlying Apache client in the constructor.
1 parent 0a89f42 commit 7b7fd3f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/main/java/org/kairosdb/client/HttpClient.java

+11-1
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,23 @@ public HttpClient(String url) throws MalformedURLException
106106
public HttpClient(HttpClientBuilder builder, String url) throws MalformedURLException
107107
{
108108
checkNotNullOrEmpty(url, "url cannot be null");
109-
checkNotNull(builder, "builder cannot be null");
109+
checkNotNull(builder, "builder must not be null");
110110
this.url = url;
111111
new URL(url); // validate url
112112
client = builder.build();
113113
typeRegistry = new DataPointTypeRegistry();
114114
}
115115

116+
public HttpClient(CloseableHttpClient client, String url) throws MalformedURLException
117+
{
118+
checkNotNullOrEmpty(url, "url cannot be null");
119+
checkNotNull(client, "client must not be null");
120+
this.url = url;
121+
new URL(url); // validate url
122+
this.client = client;
123+
typeRegistry = new DataPointTypeRegistry();
124+
}
125+
116126
public void registerCustomDataType(String groupType, Class dataPointClass)
117127
{
118128
checkNotNullOrEmpty(groupType, "groupType may not be null or empty");

0 commit comments

Comments
 (0)