Skip to content

Commit db03f8c

Browse files
whanicebeiwei30
authored andcommitted
optimize_zk_create (#1833)
1 parent 0bf6910 commit db03f8c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

dubbo-remoting/dubbo-remoting-zookeeper/src/main/java/com/alibaba/dubbo/remoting/zookeeper/support/AbstractZookeeperClient.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,14 @@ public URL getUrl() {
5252

5353
@Override
5454
public void create(String path, boolean ephemeral) {
55+
if (!ephemeral) {
56+
if (checkExists(path)) {
57+
return;
58+
}
59+
}
5560
int i = path.lastIndexOf('/');
5661
if (i > 0) {
57-
String parentPath = path.substring(0, i);
58-
if (!checkExists(parentPath)) {
59-
create(parentPath, false);
60-
}
62+
create(path.substring(0, i), false);
6163
}
6264
if (ephemeral) {
6365
createEphemeral(path);

0 commit comments

Comments
 (0)