i3wangyi commented on a change in pull request #698: Implement Azure cloud
instance information processor
URL: https://github.com/apache/helix/pull/698#discussion_r376092609
##########
File path:
helix-core/src/main/java/org/apache/helix/cloud/azure/AzureHttpUtil.java
##########
@@ -0,0 +1,45 @@
+package org.apache.helix.cloud.azure;
+
+import javax.net.ssl.SSLException;
+import org.apache.helix.HelixCloudProperty;
+import org.apache.http.client.HttpRequestRetryHandler;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.protocol.HttpContext;
+
+import java.io.IOException;
+import java.io.InterruptedIOException;
+import java.net.UnknownHostException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A dedicated http client for retrieving information from Azure Instance
Metadata Service
+ */
+class AzureHttpUtil {
Review comment:
Yes. The current CustomRestClient has one instance of `HttpClient`, a parent
class of the `CloseableHttpClient` the method tries to return. However, I see
the AzureHttpUtil is in helix-core while that factory is only visible in
helix-rest only (because previously there's no need for helix-core to perform
HTTP request).
Essentially, the factory pattern is similar and we can extract the core part
of it to helix-core and leave the difference in the separate module. For
example, in helix-core, create one HttpClientFactory which accepts a set of
general parameters (timeout, ssl, retry..) without respecting
HelixCloudProperty; And use it in rest as well as rest of places in helix-core
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]