You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by il...@apache.org on 2018/05/25 02:28:26 UTC

[incubator-dubbo] branch master updated: optimize_zk_create (#1833)

This is an automated email from the ASF dual-hosted git repository.

iluo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git


The following commit(s) were added to refs/heads/master by this push:
     new db03f8c  optimize_zk_create (#1833)
db03f8c is described below

commit db03f8c42b2cf33a9303233e31a4c9b8f88b836d
Author: whanice <yw...@gmail.com>
AuthorDate: Fri May 25 10:28:21 2018 +0800

    optimize_zk_create (#1833)
---
 .../remoting/zookeeper/support/AbstractZookeeperClient.java    | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/dubbo-remoting/dubbo-remoting-zookeeper/src/main/java/com/alibaba/dubbo/remoting/zookeeper/support/AbstractZookeeperClient.java b/dubbo-remoting/dubbo-remoting-zookeeper/src/main/java/com/alibaba/dubbo/remoting/zookeeper/support/AbstractZookeeperClient.java
index 9efd8b4..685effd 100644
--- a/dubbo-remoting/dubbo-remoting-zookeeper/src/main/java/com/alibaba/dubbo/remoting/zookeeper/support/AbstractZookeeperClient.java
+++ b/dubbo-remoting/dubbo-remoting-zookeeper/src/main/java/com/alibaba/dubbo/remoting/zookeeper/support/AbstractZookeeperClient.java
@@ -52,12 +52,14 @@ public abstract class AbstractZookeeperClient<TargetChildListener> implements Zo
 
     @Override
     public void create(String path, boolean ephemeral) {
+        if (!ephemeral) {
+            if (checkExists(path)) {
+                return;
+            }
+        }
         int i = path.lastIndexOf('/');
         if (i > 0) {
-            String parentPath = path.substring(0, i);
-            if (!checkExists(parentPath)) {
-                create(parentPath, false);
-            }
+            create(path.substring(0, i), false);
         }
         if (ephemeral) {
             createEphemeral(path);

-- 
To stop receiving notification emails like this one, please contact
iluo@apache.org.