From b38930c1ee0c6eab1e47dfea06f41caee5c51368 Mon Sep 17 00:00:00 2001 From: zane-neo Date: Mon, 26 Feb 2024 10:02:41 +0800 Subject: [PATCH] Address comments Signed-off-by: zane-neo --- .../ml/engine/httpclient/MLHttpClientFactory.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ml-algorithms/src/main/java/org/opensearch/ml/engine/httpclient/MLHttpClientFactory.java b/ml-algorithms/src/main/java/org/opensearch/ml/engine/httpclient/MLHttpClientFactory.java index 2b754307c2..eeb68ba86b 100644 --- a/ml-algorithms/src/main/java/org/opensearch/ml/engine/httpclient/MLHttpClientFactory.java +++ b/ml-algorithms/src/main/java/org/opensearch/ml/engine/httpclient/MLHttpClientFactory.java @@ -32,6 +32,13 @@ public static SdkAsyncHttpClient getAsyncHttpClient() { } } + /** + * Validate the input parameters, such as protocol, host and port. + * @param protocol The protocol supported in remote inference, currently only http and https are supported. + * @param host The host name of the remote inference server, host must be a valid ip address or domain name and must not be localhost. + * @param port The port number of the remote inference server, port number must be in range [0, 65536]. + * @throws UnknownHostException + */ public static void validate(String protocol, String host, int port) throws UnknownHostException { if (protocol != null && !"http".equalsIgnoreCase(protocol) && !"https".equalsIgnoreCase(protocol)) { log.error("Remote inference protocol is not http or https: " + protocol);