AlbumenJ commented on code in PR #14597:
URL: https://github.com/apache/dubbo/pull/14597#discussion_r1732205713


##########
dubbo-registry/dubbo-registry-zookeeper/src/main/java/org/apache/dubbo/registry/zookeeper/util/CuratorFrameworkUtils.java:
##########
@@ -72,6 +75,16 @@ public static CuratorFramework buildCuratorFramework(URL 
connectionURL, Zookeepe
         CuratorFrameworkFactory.Builder builder = 
CuratorFrameworkFactory.builder()
                 .connectString(connectionURL.getBackupAddress())
                 .retryPolicy(buildRetryPolicy(connectionURL));
+        try {
+            // use reflect to check method exist to compatibility with 
curator4, can remove in dubbo3.3 and direct call
+            // the method because 3.3 only supported curator5
+            Class<? extends Builder> builderClass = builder.getClass();
+            Method ignore = builderClass.getMethod("ensembleTracker", 
boolean.class);
+            boolean ensembleTrackerFlag = 
connectionURL.getParameter(ZOOKEEPER_ENSEMBLE_TRACKER_KEY, true);
+            builder.ensembleTracker(ensembleTrackerFlag);
+        } catch (NoSuchMethodException | SecurityException ignore) {

Review Comment:
   Maybe `Throwable` would be better here?



-- 
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: notifications-unsubscr...@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org
For additional commands, e-mail: notifications-h...@dubbo.apache.org

Reply via email to