RainYuY commented on code in PR #15594:
URL: https://github.com/apache/dubbo/pull/15594#discussion_r2242258878
##########
dubbo-registry/dubbo-registry-zookeeper/src/main/java/org/apache/dubbo/registry/zookeeper/ZookeeperServiceDiscovery.java:
##########
@@ -80,8 +82,19 @@ public class ZookeeperServiceDiscovery extends
AbstractServiceDiscovery {
public ZookeeperServiceDiscovery(ApplicationModel applicationModel, URL
registryURL) {
super(applicationModel, registryURL);
+ boolean check = RegistryFactory.isCheck(registryURL);
+ CuratorFramework curatorFramework;
try {
- this.curatorFramework = buildCuratorFramework(registryURL, this);
+ try {
+ curatorFramework = buildCuratorFramework(registryURL, this);
+ } catch (IllegalStateException e) {
+ if (check) {
+ throw e;
+ }
+ curatorFramework = buildCuratorFramework(
+
registryURL.addParameter(ZookeeperClient.ZOOKEEPER_CHECK_KEY, false), this);
Review Comment:
I think this logic can be moved to the abstract class, since both ZK and
Nacos share the same logic.
##########
dubbo-registry/dubbo-registry-zookeeper/src/main/java/org/apache/dubbo/registry/zookeeper/ZookeeperServiceDiscovery.java:
##########
@@ -80,8 +82,19 @@ public class ZookeeperServiceDiscovery extends
AbstractServiceDiscovery {
public ZookeeperServiceDiscovery(ApplicationModel applicationModel, URL
registryURL) {
super(applicationModel, registryURL);
+ boolean check = RegistryFactory.isCheck(registryURL);
+ CuratorFramework curatorFramework;
try {
- this.curatorFramework = buildCuratorFramework(registryURL, this);
+ try {
+ curatorFramework = buildCuratorFramework(registryURL, this);
+ } catch (IllegalStateException e) {
+ if (check) {
+ throw e;
+ }
+ curatorFramework = buildCuratorFramework(
+
registryURL.addParameter(ZookeeperClient.ZOOKEEPER_CHECK_KEY, false), this);
Review Comment:
I don't think we need a special key for ZK. How about using CHECK_KEY?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]