leosanqing commented on code in PR #7348:
URL: https://github.com/apache/inlong/pull/7348#discussion_r1105525604
##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/cluster/PulsarClusterOperator.java:
##########
@@ -110,19 +112,34 @@ public Boolean testConnection(ClusterRequest request) {
String.format("Pulsar ServiceUrl=%s should starts with
%s", serviceUrl, SERVICE_URL_PREFIX));
String hostPortStr = serviceUrl.replaceAll(SERVICE_URL_PREFIX, "");
- String[] hostPortArr = hostPortStr.split(InlongConstants.COLON);
- Preconditions.expectTrue(hostPortArr.length >= 2,
- String.format("Pulsar ServiceUrl=%s should has ip and
port, such as '127.0.0.1:6650'", serviceUrl));
-
- String host = hostPortArr[0];
- int port = Integer.parseInt(hostPortArr[1]);
- SocketAddress socketAddress = new InetSocketAddress(host, port);
- Socket socket = new Socket();
- socket.connect(socketAddress, 30000);
- socket.close();
- LOGGER.debug("Pulsar connection not null - connection success for
AdminUrl={}, ServiceUrl={}",
- pulsarInfo.getAdminUrl(), pulsarInfo.getUrl());
- return true;
+ boolean successConnect =
Arrays.stream(hostPortStr.split(InlongConstants.COMMA))
+ // If there are multiple addresses, as long as one
succeeds, it's considered successful
+ .anyMatch(hostPort -> {
Review Comment:
done
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]