anmolnar commented on code in PR #2320:
URL: https://github.com/apache/zookeeper/pull/2320#discussion_r2632526767


##########
zookeeper-server/pom.xml:
##########
@@ -190,6 +190,11 @@
       <artifactId>commons-io</artifactId>
       <scope>compile</scope>
     </dependency>
+    <dependency>
+      <groupId>dnsjava</groupId>
+      <artifactId>dnsjava</artifactId>
+      <version>3.5.1</version>

Review Comment:
   The version should be defined in the root-level `pom.xml` file like for 
other third party libraries.



##########
zookeeper-server/src/main/java/org/apache/zookeeper/client/ConnectionType.java:
##########
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.zookeeper.client;
+
+import org.apache.yetus.audience.InterfaceAudience;
+
+/**
+ * Represents the type of connection resolution used by ZooKeeper clients.
+ * This is an internal enum used for connection string and provider validation.
+ */
[email protected]
+public enum ConnectionType {

Review Comment:
   I can't find usages of this new type in your code.



##########
zookeeper-docs/src/main/resources/markdown/zookeeperAdmin.md:
##########
@@ -1315,6 +1315,14 @@ of servers -- that is, when deploying clusters of 
servers.
     leader election. If you want to test multiple servers on a single machine, 
then
     different ports can be used for each server.
 
+* *hostProvider.dnsSrvRefreshIntervalMs* :

Review Comment:
   I think this should be defined in seconds, not millisecs. No one should set 
this less 1 second.



##########
zookeeper-server/src/main/java/org/apache/zookeeper/client/HostProvider.java:
##########
@@ -72,4 +72,21 @@ public interface HostProvider {
      */
     boolean updateServerList(Collection<InetSocketAddress> serverAddresses, 
InetSocketAddress currentHost);
 
+    /**
+     * Returns the connection type that this HostProvider supports.
+     * Default implementation returns HOST_PORT for backward compatibility.
+     *
+     * @return the ConnectionType supported by this provider
+     */
+    default ConnectionType getSupportedConnectionType() {

Review Comment:
   Where do you use this new field? Why is this information important?



##########
zookeeper-server/src/main/java/org/apache/zookeeper/client/HostConnectionManager.java:
##########
@@ -0,0 +1,391 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.zookeeper.client;
+
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Random;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * HostConnectionManager handles the complex connection management and 
reconfiguration logic
+ */
[email protected]
+public final class HostConnectionManager {

Review Comment:
   So, basically what happened is that all of the "host providing" logic has 
been moved to `HostConnectionManager`, while the `HostProvideder` has become 
just the class whose sole responsibility is to be the source of server 
addresses.
   
   In case of `StaticHostProvider`, this is a static list supplied in the 
constructor during instantiation, while for `DnsSrvHostProvider` it comes from 
DNS and gets periodically updated.
   
   That seems to me fine. 



-- 
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]

Reply via email to