diff --git a/pom.xml b/pom.xml
index 7f536e2bc47b7..ada9b7fc5a97a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,10 +1,12 @@
-
+
+
4.0.0
io.shardingsphere
sharding-sphere
3.0.0.M5-SNAPSHOT
pom
- ${project.artifactId}
sharding-core
@@ -36,7 +38,8 @@
1.1
4.0.4
-
+
+ 3.4.6
2.10.0
1.7.0
3.4.0
@@ -153,6 +156,11 @@
${atomikos.version}
+
+ org.apache.zookeeper
+ zookeeper
+ ${zookeeper.version}
+
org.apache.curator
curator-framework
diff --git a/sharding-core/pom.xml b/sharding-core/pom.xml
index b4a964f6f0a9e..23abf663cec1f 100644
--- a/sharding-core/pom.xml
+++ b/sharding-core/pom.xml
@@ -9,7 +9,6 @@
3.0.0.M5-SNAPSHOT
sharding-core
- ${project.artifactId}
diff --git a/sharding-core/src/test/resources/parser/delete.xml b/sharding-core/src/test/resources/parser/delete.xml
index 47d26a64e4bda..e4d7e92d11a60 100644
--- a/sharding-core/src/test/resources/parser/delete.xml
+++ b/sharding-core/src/test/resources/parser/delete.xml
@@ -33,7 +33,7 @@
-
+
diff --git a/sharding-core/src/test/resources/parser/insert.xml b/sharding-core/src/test/resources/parser/insert.xml
index 841e2bfa6fcc2..a52e68d90479d 100644
--- a/sharding-core/src/test/resources/parser/insert.xml
+++ b/sharding-core/src/test/resources/parser/insert.xml
@@ -93,8 +93,8 @@
-
-
+
+
diff --git a/sharding-jdbc/pom.xml b/sharding-jdbc/pom.xml
index c610e04027e97..5915565145014 100644
--- a/sharding-jdbc/pom.xml
+++ b/sharding-jdbc/pom.xml
@@ -2,12 +2,12 @@
+ 4.0.0
- sharding-sphere
io.shardingsphere
+ sharding-sphere
3.0.0.M5-SNAPSHOT
- 4.0.0
sharding-jdbc
pom
diff --git a/sharding-jdbc/sharding-jdbc-core/pom.xml b/sharding-jdbc/sharding-jdbc-core/pom.xml
index 2bec1a4d161d6..e817b5f2386c3 100644
--- a/sharding-jdbc/sharding-jdbc-core/pom.xml
+++ b/sharding-jdbc/sharding-jdbc-core/pom.xml
@@ -1,4 +1,6 @@
-
+
4.0.0
@@ -7,7 +9,7 @@
3.0.0.M5-SNAPSHOT
sharding-jdbc-core
- ${project.artifactId}
+
io.shardingsphere
diff --git a/sharding-jdbc/sharding-jdbc-core/src/test/java/io/shardingsphere/dbtest/env/datasource/DataSourceUtil.java b/sharding-jdbc/sharding-jdbc-core/src/test/java/io/shardingsphere/dbtest/env/datasource/DataSourceUtil.java
index 6ab7a73c2719c..683dd19dbf58a 100644
--- a/sharding-jdbc/sharding-jdbc-core/src/test/java/io/shardingsphere/dbtest/env/datasource/DataSourceUtil.java
+++ b/sharding-jdbc/sharding-jdbc-core/src/test/java/io/shardingsphere/dbtest/env/datasource/DataSourceUtil.java
@@ -78,7 +78,7 @@ private static DataSource createDBCP(final DatabaseType databaseType, final Stri
result.setUrl(null == dataSourceName ? databaseEnvironment.getURL() : databaseEnvironment.getURL(dataSourceName));
result.setUsername(databaseEnvironment.getUsername());
result.setPassword(databaseEnvironment.getPassword());
- result.setMaxTotal(5);
+ result.setMaxTotal(15);
result.setValidationQuery("SELECT 1");
if (DatabaseType.Oracle == databaseType) {
result.setConnectionInitSqls(Collections.singleton("ALTER SESSION SET CURRENT_SCHEMA = " + dataSourceName));
@@ -93,7 +93,7 @@ private static DataSource createHikariCP(final DatabaseType databaseType, final
result.setJdbcUrl(null == dataSourceName ? databaseEnvironment.getURL() : databaseEnvironment.getURL(dataSourceName));
result.setUsername(databaseEnvironment.getUsername());
result.setPassword(databaseEnvironment.getPassword());
- result.setMaximumPoolSize(5);
+ result.setMaximumPoolSize(15);
result.setTransactionIsolation("TRANSACTION_READ_COMMITTED");
result.setConnectionTestQuery("SELECT 1");
if (DatabaseType.Oracle == databaseType) {
diff --git a/sharding-jdbc/sharding-jdbc-core/src/test/resources/integrate/cases/dml/dml-integrate-test-cases.xml b/sharding-jdbc/sharding-jdbc-core/src/test/resources/integrate/cases/dml/dml-integrate-test-cases.xml
index 1efe4ae591e5e..ad46b756e9e68 100644
--- a/sharding-jdbc/sharding-jdbc-core/src/test/resources/integrate/cases/dml/dml-integrate-test-cases.xml
+++ b/sharding-jdbc/sharding-jdbc-core/src/test/resources/integrate/cases/dml/dml-integrate-test-cases.xml
@@ -145,7 +145,7 @@
-
+
diff --git a/sharding-jdbc/sharding-jdbc-core/src/test/resources/integrate/cases/dql/dataset/db/select_pagination_with_diff_group_by_and_order_by.xml b/sharding-jdbc/sharding-jdbc-core/src/test/resources/integrate/cases/dql/dataset/db/select_pagination_with_diff_group_by_and_order_by.xml
index 503caa44a7029..0529e21af9a86 100644
--- a/sharding-jdbc/sharding-jdbc-core/src/test/resources/integrate/cases/dql/dataset/db/select_pagination_with_diff_group_by_and_order_by.xml
+++ b/sharding-jdbc/sharding-jdbc-core/src/test/resources/integrate/cases/dql/dataset/db/select_pagination_with_diff_group_by_and_order_by.xml
@@ -2,11 +2,5 @@
-
-
-
-
-
-
diff --git a/sharding-jdbc/sharding-jdbc-core/src/test/resources/integrate/cases/dql/dataset/dbtbl_with_masterslave/select_pagination_with_diff_group_by_and_order_by.xml b/sharding-jdbc/sharding-jdbc-core/src/test/resources/integrate/cases/dql/dataset/dbtbl_with_masterslave/select_pagination_with_diff_group_by_and_order_by.xml
index ed9e4b66bf285..0529e21af9a86 100644
--- a/sharding-jdbc/sharding-jdbc-core/src/test/resources/integrate/cases/dql/dataset/dbtbl_with_masterslave/select_pagination_with_diff_group_by_and_order_by.xml
+++ b/sharding-jdbc/sharding-jdbc-core/src/test/resources/integrate/cases/dql/dataset/dbtbl_with_masterslave/select_pagination_with_diff_group_by_and_order_by.xml
@@ -2,14 +2,5 @@
-
-
-
-
-
-
-
-
-
-
+
diff --git a/sharding-jdbc/sharding-jdbc-core/src/test/resources/integrate/cases/dql/dataset/masterslave/select_pagination_with_diff_group_by_and_order_by.xml b/sharding-jdbc/sharding-jdbc-core/src/test/resources/integrate/cases/dql/dataset/masterslave/select_pagination_with_diff_group_by_and_order_by.xml
index 503caa44a7029..0529e21af9a86 100644
--- a/sharding-jdbc/sharding-jdbc-core/src/test/resources/integrate/cases/dql/dataset/masterslave/select_pagination_with_diff_group_by_and_order_by.xml
+++ b/sharding-jdbc/sharding-jdbc-core/src/test/resources/integrate/cases/dql/dataset/masterslave/select_pagination_with_diff_group_by_and_order_by.xml
@@ -2,11 +2,5 @@
-
-
-
-
-
-
diff --git a/sharding-jdbc/sharding-jdbc-core/src/test/resources/integrate/cases/dql/dataset/tbl/select_pagination_with_diff_group_by_and_order_by.xml b/sharding-jdbc/sharding-jdbc-core/src/test/resources/integrate/cases/dql/dataset/tbl/select_pagination_with_diff_group_by_and_order_by.xml
index 6525f7ca9743b..f61551fc142d3 100644
--- a/sharding-jdbc/sharding-jdbc-core/src/test/resources/integrate/cases/dql/dataset/tbl/select_pagination_with_diff_group_by_and_order_by.xml
+++ b/sharding-jdbc/sharding-jdbc-core/src/test/resources/integrate/cases/dql/dataset/tbl/select_pagination_with_diff_group_by_and_order_by.xml
@@ -2,14 +2,4 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/sharding-jdbc/sharding-jdbc-core/src/test/resources/integrate/env.properties b/sharding-jdbc/sharding-jdbc-core/src/test/resources/integrate/env.properties
index a29bd88a939ae..d0dba0c6be7b0 100644
--- a/sharding-jdbc/sharding-jdbc-core/src/test/resources/integrate/env.properties
+++ b/sharding-jdbc/sharding-jdbc-core/src/test/resources/integrate/env.properties
@@ -1,4 +1,3 @@
-initialized=false
run.additional.cases=false
sharding.rule.type=db,tbl,dbtbl_with_masterslave,masterslave
diff --git a/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-boot-starter/pom.xml b/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-boot-starter/pom.xml
index eef098b14c9e7..ecd592f709048 100644
--- a/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-boot-starter/pom.xml
+++ b/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-boot-starter/pom.xml
@@ -1,4 +1,7 @@
-
+
+
4.0.0
io.shardingsphere
@@ -8,6 +11,13 @@
sharding-jdbc-orchestration-spring-boot-starter
+
+ io.shardingsphere
+ sharding-orchestration-reg-zookeeper-curator
+ ${project.version}
+ test
+
+
org.springframework.boot
spring-boot-starter
diff --git a/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-boot-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-boot-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
index e6f2a9207f3df..b245571c57480 100644
--- a/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-boot-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
+++ b/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-boot-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -5,14 +5,9 @@
"type": "io.shardingsphere.shardingjdbc.orchestration.spring.boot.OrchestrationSpringBootConfiguration"
},
{
- "sourceType": "io.shardingsphere.orchestration.reg.etcd.EtcdConfiguration",
- "name": "sharding.jdbc.config.orchestration.etcd",
- "type": "io.shardingsphere.orchestration.reg.etcd.EtcdConfiguration"
- },
- {
- "sourceType": "io.shardingsphere.orchestration.reg.zookeeper.ZookeeperConfiguration",
- "name": "sharding.jdbc.config.orchestration.zookeeper",
- "type": "io.shardingsphere.orchestration.reg.zookeeper.ZookeeperConfiguration"
+ "sourceType": "io.shardingsphere.orchestration.reg.api.RegistryCenterConfiguration",
+ "name": "sharding.jdbc.config.orchestration.registry",
+ "type": "io.shardingsphere.orchestration.reg.api.RegistryCenterConfiguration"
},
{
"sourceType": "io.shardingsphere.core.yaml.sharding.YamlShardingStrategyConfiguration",
@@ -77,90 +72,49 @@
"sourceType": "io.shardingsphere.shardingjdbc.util.DataSourceUtil"
},
{
- "sourceType": "io.shardingsphere.orchestration.reg.etcd.EtcdConfiguration",
- "defaultValue": 3,
- "name": "sharding.jdbc.config.orchestration.etcd.max-retries",
- "description": "Maximal retries when calling a etcd method.",
- "type": "java.lang.Integer"
- },
- {
- "sourceType": "io.shardingsphere.orchestration.reg.etcd.EtcdConfiguration",
- "defaultValue": 200,
- "name": "sharding.jdbc.config.orchestration.etcd.retry-interval-milliseconds",
- "description": "Maximal retries when calling a etcd method.",
- "type": "java.lang.Integer"
+ "sourceType": "io.shardingsphere.orchestration.reg.api.RegistryCenterConfiguration",
+ "name": "sharding.jdbc.config.orchestration.registry.server-lists",
+ "description": "Registry center server list.",
+ "type": "java.lang.String"
},
{
- "sourceType": "io.shardingsphere.orchestration.reg.etcd.EtcdConfiguration",
- "name": "sharding.jdbc.config.orchestration.etcd.server-lists",
- "description": "Etcd server list.\n \n Include ip address and port, multiple servers split by comma. Etc: {@code http:\/\/host1:2379,http:\/\/host2:2379}<\/p>.",
+ "sourceType": "io.shardingsphere.orchestration.reg.api.RegistryCenterConfiguration",
+ "name": "sharding.jdbc.config.orchestration.registry.namespace",
+ "description": "Namespace of registry center.",
"type": "java.lang.String"
},
{
- "sourceType": "io.shardingsphere.orchestration.reg.etcd.EtcdConfiguration",
- "defaultValue": 60,
- "name": "sharding.jdbc.config.orchestration.etcd.time-to-live-seconds",
- "description": "Time to live seconds of ephemeral keys.",
- "type": "java.lang.Integer"
+ "sourceType": "io.shardingsphere.orchestration.reg.api.RegistryCenterConfiguration",
+ "name": "sharding.jdbc.config.orchestration.registry.digest",
+ "description": "Digest for registry center.\n \n
Default is not need digest<\/p>.",
+ "type": "java.lang.String"
},
{
- "sourceType": "io.shardingsphere.orchestration.reg.etcd.EtcdConfiguration",
+ "sourceType": "io.shardingsphere.orchestration.reg.api.RegistryCenterConfiguration",
"defaultValue": 500,
- "name": "sharding.jdbc.config.orchestration.etcd.timeout-milliseconds",
- "description": "Timeout when calling a etcd method in milliseconds.",
+ "name": "sharding.jdbc.config.orchestration.registry.operation-timeout-milliseconds",
+ "description": "Operation timeout time in milliseconds.",
"type": "java.lang.Integer"
},
{
- "sourceType": "io.shardingsphere.orchestration.reg.zookeeper.ZookeeperConfiguration",
- "defaultValue": 1000,
- "name": "sharding.jdbc.config.orchestration.zookeeper.base-sleep-time-milliseconds",
- "description": "Base sleep time milliseconds.",
- "type": "java.lang.Integer"
- },
- {
- "sourceType": "io.shardingsphere.orchestration.reg.zookeeper.ZookeeperConfiguration",
- "defaultValue": 0,
- "name": "sharding.jdbc.config.orchestration.zookeeper.connection-timeout-milliseconds",
- "description": "Connection timeout milliseconds.",
- "type": "java.lang.Integer"
- },
- {
- "sourceType": "io.shardingsphere.orchestration.reg.zookeeper.ZookeeperConfiguration",
- "name": "sharding.jdbc.config.orchestration.zookeeper.digest",
- "description": "Digest for zookeeper.\n \n
Default is not need digest<\/p>.",
- "type": "java.lang.String"
- },
- {
- "sourceType": "io.shardingsphere.orchestration.reg.zookeeper.ZookeeperConfiguration",
+ "sourceType": "io.shardingsphere.orchestration.reg.api.RegistryCenterConfiguration",
"defaultValue": 3,
- "name": "sharding.jdbc.config.orchestration.zookeeper.max-retries",
- "description": "Max retries.",
+ "name": "sharding.jdbc.config.orchestration.registry.max-retries",
+ "description": "Max number of times to retry.",
"type": "java.lang.Integer"
},
{
- "sourceType": "io.shardingsphere.orchestration.reg.zookeeper.ZookeeperConfiguration",
- "defaultValue": 3000,
- "name": "sharding.jdbc.config.orchestration.zookeeper.max-sleep-time-milliseconds",
- "description": "Max sleep time milliseconds.",
+ "sourceType": "io.shardingsphere.orchestration.reg.api.RegistryCenterConfiguration",
+ "defaultValue": 500,
+ "name": "sharding.jdbc.config.orchestration.registry.retry-interval-milliseconds",
+ "description": "Time interval in milliseconds on each retry.",
"type": "java.lang.Integer"
},
{
- "sourceType": "io.shardingsphere.orchestration.reg.zookeeper.ZookeeperConfiguration",
- "name": "sharding.jdbc.config.orchestration.zookeeper.namespace",
- "description": "Namespace of zookeeper.",
- "type": "java.lang.String"
- },
- {
- "sourceType": "io.shardingsphere.orchestration.reg.zookeeper.ZookeeperConfiguration",
- "name": "sharding.jdbc.config.orchestration.zookeeper.server-lists",
- "description": "Zookeeper server list.\n \n
Include ip address and port, multiple servers split by comma. Etc: {@code host1:2181,host2:2181}<\/p>.",
- "type": "java.lang.String"
- },
- {
- "sourceType": "io.shardingsphere.orchestration.reg.zookeeper.ZookeeperConfiguration",
- "defaultValue": 0,
- "name": "sharding.jdbc.config.orchestration.zookeeper.session-timeout-milliseconds",
- "description": "Session timeout milliseconds.",
+ "sourceType": "io.shardingsphere.orchestration.reg.api.RegistryCenterConfiguration",
+ "defaultValue": 500,
+ "name": "sharding.jdbc.config.orchestration.registry.time-to-live-seconds",
+ "description": "Time to live in seconds of ephemeral keys.",
"type": "java.lang.Integer"
},
{
diff --git a/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-boot-starter/src/test/java/io/shardingsphere/shardingjdbc/spring/boot/util/EmbedTestingServer.java b/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-boot-starter/src/test/java/io/shardingsphere/shardingjdbc/spring/boot/util/EmbedTestingServer.java
index b002c11770ddf..83aadc3fde602 100644
--- a/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-boot-starter/src/test/java/io/shardingsphere/shardingjdbc/spring/boot/util/EmbedTestingServer.java
+++ b/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-boot-starter/src/test/java/io/shardingsphere/shardingjdbc/spring/boot/util/EmbedTestingServer.java
@@ -17,10 +17,12 @@
package io.shardingsphere.shardingjdbc.spring.boot.util;
-import io.shardingsphere.orchestration.reg.exception.RegExceptionHandler;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.curator.test.TestingServer;
+import org.apache.zookeeper.KeeperException.ConnectionLossException;
+import org.apache.zookeeper.KeeperException.NoNodeException;
+import org.apache.zookeeper.KeeperException.NodeExistsException;
import java.io.File;
import java.io.IOException;
@@ -41,22 +43,25 @@ public static void start() {
}
try {
testingServer = new TestingServer(PORT, new File(String.format("target/test_zk_data/%s/", System.nanoTime())));
- // CHECKSTYLE:OFF
} catch (final Exception ex) {
- // CHECKSTYLE:ON
- RegExceptionHandler.handleException(ex);
+ if (!isIgnoredException(ex)) {
+ throw new RuntimeException(ex);
+ }
} finally {
Runtime.getRuntime().addShutdownHook(new Thread() {
-
+
@Override
public void run() {
try {
testingServer.close();
- } catch (final IOException ex) {
- RegExceptionHandler.handleException(ex);
+ } catch (final IOException ignore) {
}
}
});
}
}
+
+ private static boolean isIgnoredException(final Throwable cause) {
+ return cause instanceof ConnectionLossException || cause instanceof NoNodeException || cause instanceof NodeExistsException;
+ }
}
diff --git a/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-boot-starter/src/test/resources/application-masterslave.properties b/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-boot-starter/src/test/resources/application-masterslave.properties
index d9f23e066841a..f551a5d14fa48 100644
--- a/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-boot-starter/src/test/resources/application-masterslave.properties
+++ b/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-boot-starter/src/test/resources/application-masterslave.properties
@@ -27,8 +27,8 @@ sharding.jdbc.config.masterslave.slave-data-source-names=ds_slave_0,ds_slave_1
sharding.jdbc.config.orchestration.name=demo_spring_boot_ds_ms
sharding.jdbc.config.orchestration.overwrite=true
-sharding.jdbc.config.orchestration.zookeeper.namespace=orchestration-spring-boot-master-slave-test
-sharding.jdbc.config.orchestration.zookeeper.server-lists=localhost:3181
+sharding.jdbc.config.orchestration.registry.namespace=orchestration-spring-boot-master-slave-test
+sharding.jdbc.config.orchestration.registry.server-lists=localhost:3181
sharding.jdbc.config.masterslave.config-map.key1=value1
sharding.jdbc.config.masterslave.config-map.key2=${sharding.jdbc.config.masterslave.config-map.key1}
diff --git a/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-boot-starter/src/test/resources/application-sharding.properties b/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-boot-starter/src/test/resources/application-sharding.properties
index 47d59d33c4b05..0f61eb2b5b513 100644
--- a/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-boot-starter/src/test/resources/application-sharding.properties
+++ b/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-boot-starter/src/test/resources/application-sharding.properties
@@ -37,7 +37,7 @@ sharding.jdbc.config.sharding.props.executor.size=100
sharding.jdbc.config.orchestration.name=demo_spring_boot_ds_sharding
sharding.jdbc.config.orchestration.overwrite=true
-sharding.jdbc.config.orchestration.zookeeper.namespace=orchestration-spring-boot-sharding-test
-sharding.jdbc.config.orchestration.zookeeper.server-lists=localhost:3181
+sharding.jdbc.config.orchestration.registry.namespace=orchestration-spring-boot-sharding-test
+sharding.jdbc.config.orchestration.registry.server-lists=localhost:3181
sharding.jdbc.config.sharding.config-map.key1=value1
\ No newline at end of file
diff --git a/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/pom.xml b/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/pom.xml
index d9f4d7954e447..b8d824bea6700 100644
--- a/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/pom.xml
+++ b/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/pom.xml
@@ -1,4 +1,7 @@
-
+
+
4.0.0
io.shardingsphere
@@ -14,6 +17,12 @@
${project.version}
test
+
+ io.shardingsphere
+ sharding-orchestration-reg-zookeeper-curator
+ ${project.version}
+ test
+
org.springframework
diff --git a/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/main/java/io/shardingsphere/shardingjdbc/orchestration/spring/namespace/constants/EtcdRegistryCenterBeanDefinitionParserTag.java b/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/main/java/io/shardingsphere/shardingjdbc/orchestration/spring/namespace/constants/RegistryCenterBeanDefinitionParserTag.java
similarity index 74%
rename from sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/main/java/io/shardingsphere/shardingjdbc/orchestration/spring/namespace/constants/EtcdRegistryCenterBeanDefinitionParserTag.java
rename to sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/main/java/io/shardingsphere/shardingjdbc/orchestration/spring/namespace/constants/RegistryCenterBeanDefinitionParserTag.java
index a1d47ba1bef6a..a5f899e036ed5 100644
--- a/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/main/java/io/shardingsphere/shardingjdbc/orchestration/spring/namespace/constants/EtcdRegistryCenterBeanDefinitionParserTag.java
+++ b/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/main/java/io/shardingsphere/shardingjdbc/orchestration/spring/namespace/constants/RegistryCenterBeanDefinitionParserTag.java
@@ -21,22 +21,26 @@
import lombok.NoArgsConstructor;
/**
- * Etcd registry center parser tag constants.
+ * Registry center parser tag constants.
*
- * @author zhangliang
+ * @author caohao
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class EtcdRegistryCenterBeanDefinitionParserTag {
+public final class RegistryCenterBeanDefinitionParserTag {
- public static final String ROOT_TAG = "etcd";
+ public static final String ROOT_TAG = "registry-center";
public static final String SERVER_LISTS_TAG = "server-lists";
- public static final String TIME_TO_LIVE_SECONDS_TAG = "time-to-live-seconds";
+ public static final String NAMESPACE_TAG = "namespace";
- public static final String TIMEOUT_MILLISECONDS_TAG = "timeout-milliseconds";
+ public static final String DIGEST_TAG = "digest";
- public static final String RETRY_INTERVAL_MILLISECONDS_TAG = "retry-interval-milliseconds";
+ public static final String OPERATION_TIMEOUT_MILLISECONDS_TAG = "operation-timeout-milliseconds";
public static final String MAX_RETRIES_TAG = "max-retries";
+
+ public static final String RETRY_INTERVAL_MILLISECONDS_TAG = "retry-interval-milliseconds";
+
+ public static final String TIME_TO_LIVE_SECONDS_TAG = "time-to-live-seconds";
}
diff --git a/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/main/java/io/shardingsphere/shardingjdbc/orchestration/spring/namespace/constants/ZookeeperRegistryCenterBeanDefinitionParserTag.java b/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/main/java/io/shardingsphere/shardingjdbc/orchestration/spring/namespace/constants/ZookeeperRegistryCenterBeanDefinitionParserTag.java
deleted file mode 100644
index 0637aea5cb9bd..0000000000000
--- a/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/main/java/io/shardingsphere/shardingjdbc/orchestration/spring/namespace/constants/ZookeeperRegistryCenterBeanDefinitionParserTag.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2016-2018 shardingsphere.io.
- *
- * Licensed 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 io.shardingsphere.shardingjdbc.orchestration.spring.namespace.constants;
-
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-
-/**
- * Zookeeper registry center parser tag constants.
- *
- * @author caohao
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class ZookeeperRegistryCenterBeanDefinitionParserTag {
-
- public static final String ROOT_TAG = "zookeeper";
-
- public static final String SERVER_LISTS_TAG = "server-lists";
-
- public static final String NAMESPACE_TAG = "namespace";
-
- public static final String BASE_SLEEP_TIME_MILLISECONDS_TAG = "base-sleep-time-milliseconds";
-
- public static final String MAX_SLEEP_TIME_MILLISECONDS_TAG = "max-sleep-time-milliseconds";
-
- public static final String MAX_RETRIES_TAG = "max-retries";
-
- public static final String SESSION_TIMEOUT_MILLISECONDS_TAG = "session-timeout-milliseconds";
-
- public static final String CONNECTION_TIMEOUT_MILLISECONDS_TAG = "connection-timeout-milliseconds";
-
- public static final String DIGEST_TAG = "digest";
-}
diff --git a/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/main/java/io/shardingsphere/shardingjdbc/orchestration/spring/namespace/handler/OrchestrationNamespaceHandler.java b/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/main/java/io/shardingsphere/shardingjdbc/orchestration/spring/namespace/handler/OrchestrationNamespaceHandler.java
index 4236a982c1fbc..85459d8eee087 100644
--- a/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/main/java/io/shardingsphere/shardingjdbc/orchestration/spring/namespace/handler/OrchestrationNamespaceHandler.java
+++ b/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/main/java/io/shardingsphere/shardingjdbc/orchestration/spring/namespace/handler/OrchestrationNamespaceHandler.java
@@ -17,10 +17,9 @@
package io.shardingsphere.shardingjdbc.orchestration.spring.namespace.handler;
-import io.shardingsphere.shardingjdbc.orchestration.spring.namespace.constants.EtcdRegistryCenterBeanDefinitionParserTag;
import io.shardingsphere.shardingjdbc.orchestration.spring.namespace.constants.MasterSlaveDataSourceBeanDefinitionParserTag;
+import io.shardingsphere.shardingjdbc.orchestration.spring.namespace.constants.RegistryCenterBeanDefinitionParserTag;
import io.shardingsphere.shardingjdbc.orchestration.spring.namespace.constants.ShardingDataSourceBeanDefinitionParserTag;
-import io.shardingsphere.shardingjdbc.orchestration.spring.namespace.constants.ZookeeperRegistryCenterBeanDefinitionParserTag;
import io.shardingsphere.shardingjdbc.orchestration.spring.namespace.parser.DataSourceBeanDefinitionParser;
import io.shardingsphere.shardingjdbc.orchestration.spring.namespace.parser.RegBeanDefinitionParser;
import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
@@ -34,8 +33,7 @@ public final class OrchestrationNamespaceHandler extends NamespaceHandlerSupport
@Override
public void init() {
- registerBeanDefinitionParser(ZookeeperRegistryCenterBeanDefinitionParserTag.ROOT_TAG, new RegBeanDefinitionParser());
- registerBeanDefinitionParser(EtcdRegistryCenterBeanDefinitionParserTag.ROOT_TAG, new RegBeanDefinitionParser());
+ registerBeanDefinitionParser(RegistryCenterBeanDefinitionParserTag.ROOT_TAG, new RegBeanDefinitionParser());
registerBeanDefinitionParser(ShardingDataSourceBeanDefinitionParserTag.ROOT_TAG, new DataSourceBeanDefinitionParser());
registerBeanDefinitionParser(MasterSlaveDataSourceBeanDefinitionParserTag.ROOT_TAG, new DataSourceBeanDefinitionParser());
}
diff --git a/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/main/java/io/shardingsphere/shardingjdbc/orchestration/spring/namespace/parser/RegBeanDefinitionParser.java b/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/main/java/io/shardingsphere/shardingjdbc/orchestration/spring/namespace/parser/RegBeanDefinitionParser.java
index 71fea8fa9349a..5fdc813076bb0 100644
--- a/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/main/java/io/shardingsphere/shardingjdbc/orchestration/spring/namespace/parser/RegBeanDefinitionParser.java
+++ b/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/main/java/io/shardingsphere/shardingjdbc/orchestration/spring/namespace/parser/RegBeanDefinitionParser.java
@@ -18,10 +18,8 @@
package io.shardingsphere.shardingjdbc.orchestration.spring.namespace.parser;
import com.google.common.base.Strings;
-import io.shardingsphere.orchestration.reg.etcd.EtcdConfiguration;
-import io.shardingsphere.orchestration.reg.zookeeper.ZookeeperConfiguration;
-import io.shardingsphere.shardingjdbc.orchestration.spring.namespace.constants.EtcdRegistryCenterBeanDefinitionParserTag;
-import io.shardingsphere.shardingjdbc.orchestration.spring.namespace.constants.ZookeeperRegistryCenterBeanDefinitionParserTag;
+import io.shardingsphere.orchestration.reg.api.RegistryCenterConfiguration;
+import io.shardingsphere.shardingjdbc.orchestration.spring.namespace.constants.RegistryCenterBeanDefinitionParserTag;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.AbstractBeanDefinitionParser;
@@ -37,29 +35,14 @@ public final class RegBeanDefinitionParser extends AbstractBeanDefinitionParser
@Override
protected AbstractBeanDefinition parseInternal(final Element element, final ParserContext parserContext) {
- return ZookeeperRegistryCenterBeanDefinitionParserTag.ROOT_TAG.equals(element.getLocalName()) ? getZookeeperConfiguration(element) : getEtcdConfiguration(element);
- }
-
- private AbstractBeanDefinition getZookeeperConfiguration(final Element element) {
- BeanDefinitionBuilder factory = BeanDefinitionBuilder.rootBeanDefinition(ZookeeperConfiguration.class);
- addPropertyValueIfNotEmpty(ZookeeperRegistryCenterBeanDefinitionParserTag.SERVER_LISTS_TAG, "serverLists", element, factory);
- addPropertyValueIfNotEmpty(ZookeeperRegistryCenterBeanDefinitionParserTag.NAMESPACE_TAG, "namespace", element, factory);
- addPropertyValueIfNotEmpty(ZookeeperRegistryCenterBeanDefinitionParserTag.BASE_SLEEP_TIME_MILLISECONDS_TAG, "baseSleepTimeMilliseconds", element, factory);
- addPropertyValueIfNotEmpty(ZookeeperRegistryCenterBeanDefinitionParserTag.MAX_SLEEP_TIME_MILLISECONDS_TAG, "maxSleepTimeMilliseconds", element, factory);
- addPropertyValueIfNotEmpty(ZookeeperRegistryCenterBeanDefinitionParserTag.MAX_RETRIES_TAG, "maxRetries", element, factory);
- addPropertyValueIfNotEmpty(ZookeeperRegistryCenterBeanDefinitionParserTag.SESSION_TIMEOUT_MILLISECONDS_TAG, "sessionTimeoutMilliseconds", element, factory);
- addPropertyValueIfNotEmpty(ZookeeperRegistryCenterBeanDefinitionParserTag.CONNECTION_TIMEOUT_MILLISECONDS_TAG, "connectionTimeoutMilliseconds", element, factory);
- addPropertyValueIfNotEmpty(ZookeeperRegistryCenterBeanDefinitionParserTag.DIGEST_TAG, "digest", element, factory);
- return factory.getBeanDefinition();
- }
-
- private AbstractBeanDefinition getEtcdConfiguration(final Element element) {
- BeanDefinitionBuilder factory = BeanDefinitionBuilder.rootBeanDefinition(EtcdConfiguration.class);
- addPropertyValueIfNotEmpty(EtcdRegistryCenterBeanDefinitionParserTag.SERVER_LISTS_TAG, "serverLists", element, factory);
- addPropertyValueIfNotEmpty(EtcdRegistryCenterBeanDefinitionParserTag.TIME_TO_LIVE_SECONDS_TAG, "timeToLiveSeconds", element, factory);
- addPropertyValueIfNotEmpty(EtcdRegistryCenterBeanDefinitionParserTag.TIMEOUT_MILLISECONDS_TAG, "timeoutMilliseconds", element, factory);
- addPropertyValueIfNotEmpty(EtcdRegistryCenterBeanDefinitionParserTag.RETRY_INTERVAL_MILLISECONDS_TAG, "retryIntervalMilliseconds", element, factory);
- addPropertyValueIfNotEmpty(EtcdRegistryCenterBeanDefinitionParserTag.MAX_RETRIES_TAG, "maxRetries", element, factory);
+ BeanDefinitionBuilder factory = BeanDefinitionBuilder.rootBeanDefinition(RegistryCenterConfiguration.class);
+ addPropertyValueIfNotEmpty(RegistryCenterBeanDefinitionParserTag.SERVER_LISTS_TAG, "serverLists", element, factory);
+ addPropertyValueIfNotEmpty(RegistryCenterBeanDefinitionParserTag.NAMESPACE_TAG, "namespace", element, factory);
+ addPropertyValueIfNotEmpty(RegistryCenterBeanDefinitionParserTag.DIGEST_TAG, "digest", element, factory);
+ addPropertyValueIfNotEmpty(RegistryCenterBeanDefinitionParserTag.OPERATION_TIMEOUT_MILLISECONDS_TAG, "operationTimeoutMilliseconds", element, factory);
+ addPropertyValueIfNotEmpty(RegistryCenterBeanDefinitionParserTag.MAX_RETRIES_TAG, "maxRetries", element, factory);
+ addPropertyValueIfNotEmpty(RegistryCenterBeanDefinitionParserTag.RETRY_INTERVAL_MILLISECONDS_TAG, "retryIntervalMilliseconds", element, factory);
+ addPropertyValueIfNotEmpty(RegistryCenterBeanDefinitionParserTag.TIME_TO_LIVE_SECONDS_TAG, "timeToLiveSeconds", element, factory);
return factory.getBeanDefinition();
}
diff --git a/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/main/resources/META-INF/namespace/orchestration.xsd b/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/main/resources/META-INF/namespace/orchestration.xsd
index 61271afee2963..fa8503c8cbfce 100644
--- a/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/main/resources/META-INF/namespace/orchestration.xsd
+++ b/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/main/resources/META-INF/namespace/orchestration.xsd
@@ -21,31 +21,17 @@
-
+
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
diff --git a/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/test/java/io/shardingsphere/shardingjdbc/orchestration/spring/util/EmbedTestingServer.java b/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/test/java/io/shardingsphere/shardingjdbc/orchestration/spring/util/EmbedTestingServer.java
index 72a9ecd9716e4..5feb34b66d37e 100644
--- a/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/test/java/io/shardingsphere/shardingjdbc/orchestration/spring/util/EmbedTestingServer.java
+++ b/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/test/java/io/shardingsphere/shardingjdbc/orchestration/spring/util/EmbedTestingServer.java
@@ -17,10 +17,12 @@
package io.shardingsphere.shardingjdbc.orchestration.spring.util;
-import io.shardingsphere.orchestration.reg.exception.RegExceptionHandler;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.curator.test.TestingServer;
+import org.apache.zookeeper.KeeperException.ConnectionLossException;
+import org.apache.zookeeper.KeeperException.NoNodeException;
+import org.apache.zookeeper.KeeperException.NodeExistsException;
import java.io.File;
import java.io.IOException;
@@ -41,22 +43,25 @@ public static void start() {
}
try {
testingServer = new TestingServer(PORT, new File(String.format("target/test_zk_data/%s/", System.nanoTime())));
- // CHECKSTYLE:OFF
} catch (final Exception ex) {
- // CHECKSTYLE:ON
- RegExceptionHandler.handleException(ex);
+ if (!isIgnoredException(ex)) {
+ throw new RuntimeException(ex);
+ }
} finally {
Runtime.getRuntime().addShutdownHook(new Thread() {
-
+
@Override
public void run() {
try {
testingServer.close();
- } catch (final IOException ex) {
- RegExceptionHandler.handleException(ex);
+ } catch (final IOException ignore) {
}
}
});
}
}
+
+ private static boolean isIgnoredException(final Throwable cause) {
+ return cause instanceof ConnectionLossException || cause instanceof NoNodeException || cause instanceof NodeExistsException;
+ }
}
diff --git a/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/test/resources/META-INF/rdb/masterSlaveOrchestration.xml b/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/test/resources/META-INF/rdb/masterSlaveOrchestration.xml
index 57265a570d03c..d73d57de7352a 100644
--- a/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/test/resources/META-INF/rdb/masterSlaveOrchestration.xml
+++ b/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/test/resources/META-INF/rdb/masterSlaveOrchestration.xml
@@ -8,7 +8,7 @@
http://shardingsphere.io/schema/shardingsphere/orchestration/orchestration.xsd">
-
+
diff --git a/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/test/resources/META-INF/rdb/shardingMasterSlaveOrchestration.xml b/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/test/resources/META-INF/rdb/shardingMasterSlaveOrchestration.xml
index 6ba4da4159a0f..b4cc17854074f 100644
--- a/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/test/resources/META-INF/rdb/shardingMasterSlaveOrchestration.xml
+++ b/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/test/resources/META-INF/rdb/shardingMasterSlaveOrchestration.xml
@@ -7,9 +7,9 @@
http://shardingsphere.io/schema/shardingsphere/orchestration
http://shardingsphere.io/schema/shardingsphere/orchestration/orchestration.xsd">
-
-
-
+
+
+
diff --git a/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/test/resources/META-INF/rdb/shardingOrchestration.xml b/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/test/resources/META-INF/rdb/shardingOrchestration.xml
index 60fca6866b19e..271b27d5d1954 100644
--- a/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/test/resources/META-INF/rdb/shardingOrchestration.xml
+++ b/sharding-jdbc/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-namespace/src/test/resources/META-INF/rdb/shardingOrchestration.xml
@@ -8,7 +8,7 @@
http://shardingsphere.io/schema/shardingsphere/orchestration/orchestration.xsd">
-
+
diff --git a/sharding-jdbc/sharding-jdbc-orchestration/pom.xml b/sharding-jdbc/sharding-jdbc-orchestration/pom.xml
index b80a1c72e0dec..7cc67cd71dd56 100644
--- a/sharding-jdbc/sharding-jdbc-orchestration/pom.xml
+++ b/sharding-jdbc/sharding-jdbc-orchestration/pom.xml
@@ -2,12 +2,12 @@
+ 4.0.0
io.shardingsphere
sharding-jdbc
3.0.0.M5-SNAPSHOT
- 4.0.0
sharding-jdbc-orchestration
@@ -21,6 +21,17 @@
sharding-orchestration-core
${project.version}
+
+ io.shardingsphere
+ sharding-core
+ ${project.version}
+
+
+ io.shardingsphere
+ sharding-orchestration-reg-zookeeper-curator
+ ${project.version}
+ test
+
org.apache.curator
diff --git a/sharding-jdbc/sharding-jdbc-orchestration/src/test/java/io/shardingsphere/shardingjdbc/orchestration/api/yaml/util/EmbedTestingServer.java b/sharding-jdbc/sharding-jdbc-orchestration/src/test/java/io/shardingsphere/shardingjdbc/orchestration/api/yaml/util/EmbedTestingServer.java
index 112a56ea109e9..ffed7aadf7d25 100644
--- a/sharding-jdbc/sharding-jdbc-orchestration/src/test/java/io/shardingsphere/shardingjdbc/orchestration/api/yaml/util/EmbedTestingServer.java
+++ b/sharding-jdbc/sharding-jdbc-orchestration/src/test/java/io/shardingsphere/shardingjdbc/orchestration/api/yaml/util/EmbedTestingServer.java
@@ -17,10 +17,12 @@
package io.shardingsphere.shardingjdbc.orchestration.api.yaml.util;
-import io.shardingsphere.orchestration.reg.exception.RegExceptionHandler;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.curator.test.TestingServer;
+import org.apache.zookeeper.KeeperException.ConnectionLossException;
+import org.apache.zookeeper.KeeperException.NoNodeException;
+import org.apache.zookeeper.KeeperException.NodeExistsException;
import java.io.File;
import java.io.IOException;
@@ -41,10 +43,10 @@ public static void start() {
}
try {
testingServer = new TestingServer(PORT, new File(String.format("target/test_zk_data/%s/", System.nanoTime())));
- // CHECKSTYLE:OFF
} catch (final Exception ex) {
- // CHECKSTYLE:ON
- RegExceptionHandler.handleException(ex);
+ if (!isIgnoredException(ex)) {
+ throw new RuntimeException(ex);
+ }
} finally {
Runtime.getRuntime().addShutdownHook(new Thread() {
@@ -52,11 +54,14 @@ public static void start() {
public void run() {
try {
testingServer.close();
- } catch (final IOException ex) {
- RegExceptionHandler.handleException(ex);
+ } catch (final IOException ignore) {
}
}
});
- }
+ }
+ }
+
+ private static boolean isIgnoredException(final Throwable cause) {
+ return cause instanceof ConnectionLossException || cause instanceof NoNodeException || cause instanceof NodeExistsException;
}
}
diff --git a/sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/ms/configWithMasterSlaveDataSourceWithProps.yaml b/sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/ms/configWithMasterSlaveDataSourceWithProps.yaml
index 3f8afef2f3103..568d5e58a10e3 100644
--- a/sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/ms/configWithMasterSlaveDataSourceWithProps.yaml
+++ b/sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/ms/configWithMasterSlaveDataSourceWithProps.yaml
@@ -33,6 +33,6 @@ masterSlaveRule:
orchestration:
name: demo_ds_ms
overwrite: true
- zookeeper:
- namespace: orchestration-yaml-test
+ registry:
serverLists: localhost:3181
+ namespace: orchestration-yaml-test
diff --git a/sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/ms/configWithMasterSlaveDataSourceWithoutProps.yaml b/sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/ms/configWithMasterSlaveDataSourceWithoutProps.yaml
index 1ab70185193ac..d9d3667070daa 100644
--- a/sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/ms/configWithMasterSlaveDataSourceWithoutProps.yaml
+++ b/sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/ms/configWithMasterSlaveDataSourceWithoutProps.yaml
@@ -28,6 +28,6 @@ masterSlaveRule:
orchestration:
name: demo_ds_ms
overwrite: true
- zookeeper:
- namespace: orchestration-yaml-test
+ registry:
serverLists: localhost:3181
+ namespace: orchestration-yaml-test
diff --git a/sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithDataSourceWithProps.yaml b/sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithDataSourceWithProps.yaml
index eb4226baa6a86..c03111b6d4ba2 100644
--- a/sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithDataSourceWithProps.yaml
+++ b/sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithDataSourceWithProps.yaml
@@ -56,6 +56,6 @@ shardingRule:
orchestration:
name: demo_ds_ms
overwrite: true
- zookeeper:
- namespace: orchestration-yaml-test
+ registry:
serverLists: localhost:3181
+ namespace: orchestration-yaml-test
diff --git a/sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithDataSourceWithoutProps.yaml b/sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithDataSourceWithoutProps.yaml
index 10c25bf1b5657..772042c3cb3ce 100644
--- a/sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithDataSourceWithoutProps.yaml
+++ b/sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithDataSourceWithoutProps.yaml
@@ -53,6 +53,6 @@ shardingRule:
orchestration:
name: demo_ds_ms
overwrite: true
- zookeeper:
- namespace: orchestration-yaml-test
+ registry:
serverLists: localhost:3181
+ namespace: orchestration-yaml-test
diff --git a/sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithoutDataSourceWithProps.yaml b/sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithoutDataSourceWithProps.yaml
index a80ff2ab8a671..ac10e5d4ab7aa 100644
--- a/sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithoutDataSourceWithProps.yaml
+++ b/sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithoutDataSourceWithProps.yaml
@@ -42,6 +42,6 @@ shardingRule:
orchestration:
name: demo_ds_ms
overwrite: true
- zookeeper:
- namespace: orchestration-yaml-test
+ registry:
serverLists: localhost:3181
+ namespace: orchestration-yaml-test
diff --git a/sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithoutDataSourceWithoutProps.yaml b/sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithoutDataSourceWithoutProps.yaml
index 2f932aad39287..a94deef1f8250 100644
--- a/sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithoutDataSourceWithoutProps.yaml
+++ b/sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithoutDataSourceWithoutProps.yaml
@@ -36,6 +36,6 @@ shardingRule:
orchestration:
name: demo_ds_ms
- zookeeper:
- namespace: orchestration-yaml-test
+ registry:
serverLists: localhost:3181
+ namespace: orchestration-yaml-test
diff --git a/sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithDataSourceWithProps.yaml b/sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithDataSourceWithProps.yaml
index 44fbbafc2b839..ad33b465c42e3 100644
--- a/sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithDataSourceWithProps.yaml
+++ b/sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithDataSourceWithProps.yaml
@@ -79,6 +79,6 @@ shardingRule:
orchestration:
name: demo_ds_ms
overwrite: true
- zookeeper:
- namespace: orchestration-yaml-test
+ registry:
serverLists: localhost:3181
+ namespace: orchestration-yaml-test
diff --git a/sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithDataSourceWithoutProps.yaml b/sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithDataSourceWithoutProps.yaml
index 677be65c7d946..b8fb93dde80d0 100644
--- a/sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithDataSourceWithoutProps.yaml
+++ b/sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithDataSourceWithoutProps.yaml
@@ -77,6 +77,6 @@ shardingRule:
orchestration:
name: demo_ds_ms
overwrite: true
- zookeeper:
- namespace: orchestration-yaml-test
+ registry:
serverLists: localhost:3181
+ namespace: orchestration-yaml-test
diff --git a/sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithoutDataSourceWithProps.yaml b/sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithoutDataSourceWithProps.yaml
index 15a08f85f64a7..17d10719b6794 100644
--- a/sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithoutDataSourceWithProps.yaml
+++ b/sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithoutDataSourceWithProps.yaml
@@ -50,6 +50,6 @@ shardingRule:
orchestration:
name: demo_ds_ms
overwrite: true
- zookeeper:
- namespace: orchestration-yaml-test
+ registry:
serverLists: localhost:3181
+ namespace: orchestration-yaml-test
diff --git a/sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithoutDataSourceWithoutProps.yaml b/sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithoutDataSourceWithoutProps.yaml
index f222bbe776426..0644710a561db 100644
--- a/sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithoutDataSourceWithoutProps.yaml
+++ b/sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithoutDataSourceWithoutProps.yaml
@@ -49,6 +49,6 @@ shardingRule:
orchestration:
name: demo_ds_ms
- zookeeper:
- namespace: orchestration-yaml-test
+ registry:
serverLists: localhost:3181
+ namespace: orchestration-yaml-test
diff --git a/sharding-jdbc/sharding-jdbc-spring/sharding-jdbc-spring-boot-starter/pom.xml b/sharding-jdbc/sharding-jdbc-spring/sharding-jdbc-spring-boot-starter/pom.xml
index ce81ba8a1e8cc..9d546d265045f 100644
--- a/sharding-jdbc/sharding-jdbc-spring/sharding-jdbc-spring-boot-starter/pom.xml
+++ b/sharding-jdbc/sharding-jdbc-spring/sharding-jdbc-spring-boot-starter/pom.xml
@@ -1,4 +1,7 @@
-
+
+
4.0.0
io.shardingsphere
@@ -6,6 +9,7 @@
3.0.0.M5-SNAPSHOT
sharding-jdbc-spring-boot-starter
+
org.springframework.boot
diff --git a/sharding-jdbc/sharding-jdbc-spring/sharding-jdbc-spring-namespace/pom.xml b/sharding-jdbc/sharding-jdbc-spring/sharding-jdbc-spring-namespace/pom.xml
index c9ebe57cc3d01..c55e5054642a9 100644
--- a/sharding-jdbc/sharding-jdbc-spring/sharding-jdbc-spring-namespace/pom.xml
+++ b/sharding-jdbc/sharding-jdbc-spring/sharding-jdbc-spring-namespace/pom.xml
@@ -1,4 +1,7 @@
-
+
+
4.0.0
io.shardingsphere
@@ -6,6 +9,7 @@
3.0.0.M5-SNAPSHOT
sharding-jdbc-spring-namespace
+
org.springframework
diff --git a/sharding-opentracing/pom.xml b/sharding-opentracing/pom.xml
index 2a0fdb458d4d6..49200a6d2b801 100644
--- a/sharding-opentracing/pom.xml
+++ b/sharding-opentracing/pom.xml
@@ -9,7 +9,6 @@
3.0.0.M5-SNAPSHOT
sharding-opentracing
- ${project.artifactId}
diff --git a/sharding-orchestration/pom.xml b/sharding-orchestration/pom.xml
index f99603aaab727..14d21b743b68c 100644
--- a/sharding-orchestration/pom.xml
+++ b/sharding-orchestration/pom.xml
@@ -2,15 +2,14 @@
+ 4.0.0
io.shardingsphere
sharding-sphere
3.0.0.M5-SNAPSHOT
- 4.0.0
sharding-orchestration
pom
- ${project.artifactId}
sharding-orchestration-core
diff --git a/sharding-orchestration/sharding-orchestration-core/pom.xml b/sharding-orchestration/sharding-orchestration-core/pom.xml
index 8fbed546c60a6..8684a074f7183 100644
--- a/sharding-orchestration/sharding-orchestration-core/pom.xml
+++ b/sharding-orchestration/sharding-orchestration-core/pom.xml
@@ -2,24 +2,31 @@
+ 4.0.0
- sharding-orchestration
io.shardingsphere
+ sharding-orchestration
3.0.0.M5-SNAPSHOT
- 4.0.0
sharding-orchestration-core
io.shardingsphere
- sharding-orchestration-reg
+ sharding-core
+ ${project.version}
+
+
+ io.shardingsphere
+ sharding-orchestration-reg-api
${project.version}
+
io.shardingsphere
- sharding-core
+ sharding-orchestration-reg-zookeeper-curator
${project.version}
+ test
diff --git a/sharding-orchestration/sharding-orchestration-core/src/main/java/io/shardingsphere/orchestration/internal/OrchestrationFacade.java b/sharding-orchestration/sharding-orchestration-core/src/main/java/io/shardingsphere/orchestration/internal/OrchestrationFacade.java
index b6b502aec3b43..5b4690e9af0aa 100644
--- a/sharding-orchestration/sharding-orchestration-core/src/main/java/io/shardingsphere/orchestration/internal/OrchestrationFacade.java
+++ b/sharding-orchestration/sharding-orchestration-core/src/main/java/io/shardingsphere/orchestration/internal/OrchestrationFacade.java
@@ -30,11 +30,6 @@
import io.shardingsphere.orchestration.internal.state.instance.InstanceStateService;
import io.shardingsphere.orchestration.reg.api.RegistryCenter;
import io.shardingsphere.orchestration.reg.api.RegistryCenterConfiguration;
-import io.shardingsphere.orchestration.reg.etcd.EtcdConfiguration;
-import io.shardingsphere.orchestration.reg.etcd.EtcdRegistryCenter;
-import io.shardingsphere.orchestration.reg.newzk.NewZookeeperRegistryCenter;
-import io.shardingsphere.orchestration.reg.zookeeper.ZookeeperConfiguration;
-import io.shardingsphere.orchestration.reg.zookeeper.ZookeeperRegistryCenter;
import io.shardingsphere.shardingjdbc.jdbc.core.datasource.MasterSlaveDataSource;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
@@ -44,6 +39,7 @@
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
+import java.util.ServiceLoader;
/**
* Orchestration service facade.
@@ -69,7 +65,7 @@ public final class OrchestrationFacade implements AutoCloseable {
private final RegistryCenter regCenter;
public OrchestrationFacade(final OrchestrationConfiguration orchestrationConfig) {
- regCenter = createRegistryCenter(orchestrationConfig.getRegCenterConfig());
+ regCenter = loadRegistryCenter(orchestrationConfig.getRegCenterConfig());
isOverwrite = orchestrationConfig.isOverwrite();
configService = new ConfigurationService(orchestrationConfig.getName(), regCenter);
instanceStateService = new InstanceStateService(orchestrationConfig.getName(), regCenter);
@@ -77,23 +73,20 @@ public OrchestrationFacade(final OrchestrationConfiguration orchestrationConfig)
listenerManager = new ListenerFactory(orchestrationConfig.getName(), regCenter);
}
- private RegistryCenter createRegistryCenter(final RegistryCenterConfiguration regCenterConfig) {
+ private RegistryCenter loadRegistryCenter(final RegistryCenterConfiguration regCenterConfig) {
Preconditions.checkNotNull(regCenterConfig, "Registry center configuration cannot be null.");
- if (regCenterConfig instanceof ZookeeperConfiguration) {
- return getZookeeperRegistryCenter((ZookeeperConfiguration) regCenterConfig);
+ RegistryCenter result = null;
+ int count = 0;
+ for (RegistryCenter each : ServiceLoader.load(RegistryCenter.class)) {
+ result = each;
+ count++;
}
- if (regCenterConfig instanceof EtcdConfiguration) {
- return new EtcdRegistryCenter((EtcdConfiguration) regCenterConfig);
- }
- throw new UnsupportedOperationException(regCenterConfig.getClass().getName());
- }
-
- private RegistryCenter getZookeeperRegistryCenter(final ZookeeperConfiguration regCenterConfig) {
- if (regCenterConfig.isUseNative()) {
- return new NewZookeeperRegistryCenter(regCenterConfig);
- } else {
- return new ZookeeperRegistryCenter(regCenterConfig);
+ Preconditions.checkNotNull(result, "Cannot load implementation class for `RegistryCenter`");
+ if (1 != count) {
+ log.warn("Find more than one RegistryCenter implementation class, use `{}` now", result.getClass().getName());
}
+ result.init(regCenterConfig);
+ return result;
}
/**
diff --git a/sharding-orchestration/sharding-orchestration-core/src/main/java/io/shardingsphere/orchestration/yaml/YamlOrchestrationConfiguration.java b/sharding-orchestration/sharding-orchestration-core/src/main/java/io/shardingsphere/orchestration/yaml/YamlOrchestrationConfiguration.java
index 670ad603e1c12..1eadab5c6f657 100644
--- a/sharding-orchestration/sharding-orchestration-core/src/main/java/io/shardingsphere/orchestration/yaml/YamlOrchestrationConfiguration.java
+++ b/sharding-orchestration/sharding-orchestration-core/src/main/java/io/shardingsphere/orchestration/yaml/YamlOrchestrationConfiguration.java
@@ -19,8 +19,7 @@
import com.google.common.base.Preconditions;
import io.shardingsphere.orchestration.config.OrchestrationConfiguration;
-import io.shardingsphere.orchestration.reg.etcd.EtcdConfiguration;
-import io.shardingsphere.orchestration.reg.zookeeper.ZookeeperConfiguration;
+import io.shardingsphere.orchestration.reg.api.RegistryCenterConfiguration;
import lombok.Getter;
import lombok.Setter;
@@ -36,9 +35,7 @@ public class YamlOrchestrationConfiguration {
private String name;
- private EtcdConfiguration etcd;
-
- private ZookeeperConfiguration zookeeper;
+ private RegistryCenterConfiguration registry;
private boolean overwrite;
@@ -48,7 +45,7 @@ public class YamlOrchestrationConfiguration {
* @return orchestration master-slave rule configuration from yaml
*/
public OrchestrationConfiguration getOrchestrationConfiguration() {
- Preconditions.checkState(null == etcd || null == zookeeper, "Can't config both zookeeper and etcd as registry center!");
- return new OrchestrationConfiguration(getName(), null != etcd ? etcd : zookeeper, overwrite);
+ Preconditions.checkState(null != registry, "Registry center must be required!");
+ return new OrchestrationConfiguration(getName(), registry, overwrite);
}
}
diff --git a/sharding-orchestration/sharding-orchestration-reg/pom.xml b/sharding-orchestration/sharding-orchestration-reg/pom.xml
index efd0aa1b8ad39..1a2c4e20ebabd 100644
--- a/sharding-orchestration/sharding-orchestration-reg/pom.xml
+++ b/sharding-orchestration/sharding-orchestration-reg/pom.xml
@@ -2,48 +2,19 @@
+ 4.0.0
- sharding-orchestration
io.shardingsphere
+ sharding-orchestration
3.0.0.M5-SNAPSHOT
- 4.0.0
sharding-orchestration-reg
+ pom
-
-
- org.apache.curator
- curator-framework
-
-
- org.apache.curator
- curator-client
-
-
- org.apache.curator
- curator-recipes
-
-
- io.grpc
- grpc-netty
-
-
- io.grpc
- grpc-protobuf
-
-
- io.grpc
- grpc-stub
-
-
- com.github.rholder
- guava-retrying
-
-
-
- org.apache.curator
- curator-test
-
-
+
+ sharding-orchestration-reg-api
+ sharding-orchestration-reg-zookeeper-curator
+ sharding-orchestration-reg-native-zookeeper
+ sharding-orchestration-reg-etcd
+
-
diff --git a/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-api/pom.xml b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-api/pom.xml
new file mode 100644
index 0000000000000..1a881e1241703
--- /dev/null
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-api/pom.xml
@@ -0,0 +1,12 @@
+
+
+ 4.0.0
+
+ io.shardingsphere
+ sharding-orchestration-reg
+ 3.0.0.M5-SNAPSHOT
+
+ sharding-orchestration-reg-api
+
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/api/RegistryCenter.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-api/src/main/java/io/shardingsphere/orchestration/reg/api/RegistryCenter.java
similarity index 93%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/api/RegistryCenter.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-api/src/main/java/io/shardingsphere/orchestration/reg/api/RegistryCenter.java
index 58939d02a4b07..9aa573dc1fcf3 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/api/RegistryCenter.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-api/src/main/java/io/shardingsphere/orchestration/reg/api/RegistryCenter.java
@@ -28,6 +28,13 @@
*/
public interface RegistryCenter extends AutoCloseable {
+ /**
+ * Initialize registry center.
+ *
+ * @param config registry center configuration
+ */
+ void init(RegistryCenterConfiguration config);
+
/**
* Get data from registry center.
*
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/etcd/EtcdConfiguration.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-api/src/main/java/io/shardingsphere/orchestration/reg/api/RegistryCenterConfiguration.java
similarity index 56%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/etcd/EtcdConfiguration.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-api/src/main/java/io/shardingsphere/orchestration/reg/api/RegistryCenterConfiguration.java
index 6c27aa678afd5..ed4151a2f52d6 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/etcd/EtcdConfiguration.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-api/src/main/java/io/shardingsphere/orchestration/reg/api/RegistryCenterConfiguration.java
@@ -15,45 +15,52 @@
*
*/
-package io.shardingsphere.orchestration.reg.etcd;
+package io.shardingsphere.orchestration.reg.api;
-import io.shardingsphere.orchestration.reg.api.RegistryCenterConfiguration;
import lombok.Getter;
import lombok.Setter;
/**
- * Etcd configuration.
+ * Registry center configuration.
*
- * @author junxiong
+ * @author zhangliang
*/
@Getter
@Setter
-public final class EtcdConfiguration implements RegistryCenterConfiguration {
+public final class RegistryCenterConfiguration {
/**
- * Etcd server list.
- *
- * Include ip address and port, multiple servers split by comma. Etc: {@code http://host1:2379,http://host2:2379}
+ * Server list of registry center.
*/
private String serverLists;
/**
- * Time to live seconds of ephemeral keys.
+ * Namespace of registry center.
*/
- private int timeToLiveSeconds = 60;
+ private String namespace;
/**
- * Timeout when calling a etcd method in milliseconds.
+ * Digest of registry center.
*/
- private int timeoutMilliseconds = 500;
+ private String digest;
/**
- * Maximal retries when calling a etcd method.
+ * Operation timeout time in milliseconds.
*/
- private int retryIntervalMilliseconds = 200;
+ private int operationTimeoutMilliseconds = 500;
/**
- * Maximal retries when calling a etcd method.
+ * Max number of times to retry.
*/
private int maxRetries = 3;
+
+ /**
+ * Time interval in milliseconds on each retry.
+ */
+ private int retryIntervalMilliseconds = 500;
+
+ /**
+ * Time to live in seconds of ephemeral keys.
+ */
+ private int timeToLiveSeconds = 60;
}
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/exception/RegException.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-api/src/main/java/io/shardingsphere/orchestration/reg/exception/RegistryCenterException.java
similarity index 80%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/exception/RegException.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-api/src/main/java/io/shardingsphere/orchestration/reg/exception/RegistryCenterException.java
index 9a4a5275a843f..77e0a3d3d4c39 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/exception/RegException.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-api/src/main/java/io/shardingsphere/orchestration/reg/exception/RegistryCenterException.java
@@ -22,15 +22,15 @@
*
* @author zhangliang
*/
-public final class RegException extends RuntimeException {
+public final class RegistryCenterException extends RuntimeException {
private static final long serialVersionUID = -6417179023552012152L;
- public RegException(final String errorMessage, final Object... args) {
+ public RegistryCenterException(final String errorMessage, final Object... args) {
super(String.format(errorMessage, args));
}
- public RegException(final Exception cause) {
+ public RegistryCenterException(final Exception cause) {
super(cause);
}
}
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/listener/DataChangedEvent.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-api/src/main/java/io/shardingsphere/orchestration/reg/listener/DataChangedEvent.java
similarity index 96%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/listener/DataChangedEvent.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-api/src/main/java/io/shardingsphere/orchestration/reg/listener/DataChangedEvent.java
index 6437354d58098..d8164bae24d03 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/listener/DataChangedEvent.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-api/src/main/java/io/shardingsphere/orchestration/reg/listener/DataChangedEvent.java
@@ -27,7 +27,7 @@
*/
@RequiredArgsConstructor
@Getter
-public class DataChangedEvent {
+public final class DataChangedEvent {
private final Type eventType;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/listener/EventListener.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-api/src/main/java/io/shardingsphere/orchestration/reg/listener/EventListener.java
similarity index 100%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/listener/EventListener.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-api/src/main/java/io/shardingsphere/orchestration/reg/listener/EventListener.java
diff --git a/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-etcd/pom.xml b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-etcd/pom.xml
new file mode 100644
index 0000000000000..9380128ffa970
--- /dev/null
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-etcd/pom.xml
@@ -0,0 +1,37 @@
+
+
+ 4.0.0
+
+ io.shardingsphere
+ sharding-orchestration-reg
+ 3.0.0.M5-SNAPSHOT
+
+ sharding-orchestration-reg-etcd
+
+
+
+ io.shardingsphere
+ sharding-orchestration-reg-api
+ ${project.version}
+
+
+
+ io.grpc
+ grpc-netty
+
+
+ io.grpc
+ grpc-protobuf
+
+
+ io.grpc
+ grpc-stub
+
+
+ com.github.rholder
+ guava-retrying
+
+
+
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/etcd/EtcdRegistryCenter.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-etcd/src/main/java/io/shardingsphere/orchestration/reg/etcd/EtcdRegistryCenter.java
similarity index 83%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/etcd/EtcdRegistryCenter.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-etcd/src/main/java/io/shardingsphere/orchestration/reg/etcd/EtcdRegistryCenter.java
index a91e69325e4b9..b147d6eb9a046 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/etcd/EtcdRegistryCenter.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-etcd/src/main/java/io/shardingsphere/orchestration/reg/etcd/EtcdRegistryCenter.java
@@ -18,26 +18,28 @@
package io.shardingsphere.orchestration.reg.etcd;
import com.google.common.base.Optional;
+import com.google.common.base.Splitter;
import com.google.protobuf.ByteString;
import etcdserverpb.KVGrpc;
import etcdserverpb.KVGrpc.KVFutureStub;
import etcdserverpb.LeaseGrpc;
import etcdserverpb.LeaseGrpc.LeaseFutureStub;
-import etcdserverpb.Rpc.WatchCreateRequest;
import etcdserverpb.Rpc.LeaseGrantRequest;
import etcdserverpb.Rpc.PutRequest;
import etcdserverpb.Rpc.RangeRequest;
import etcdserverpb.Rpc.RangeResponse;
+import etcdserverpb.Rpc.WatchCreateRequest;
+import etcdserverpb.Rpc.WatchRequest;
import etcdserverpb.WatchGrpc;
import etcdserverpb.WatchGrpc.WatchStub;
-import etcdserverpb.Rpc.WatchRequest;
import io.grpc.Channel;
import io.shardingsphere.orchestration.reg.api.RegistryCenter;
+import io.shardingsphere.orchestration.reg.api.RegistryCenterConfiguration;
import io.shardingsphere.orchestration.reg.etcd.internal.channel.EtcdChannelFactory;
import io.shardingsphere.orchestration.reg.etcd.internal.keepalive.KeepAlive;
import io.shardingsphere.orchestration.reg.etcd.internal.retry.EtcdRetryEngine;
import io.shardingsphere.orchestration.reg.etcd.internal.watcher.EtcdWatchStreamObserver;
-import io.shardingsphere.orchestration.reg.exception.RegException;
+import io.shardingsphere.orchestration.reg.exception.RegistryCenterException;
import io.shardingsphere.orchestration.reg.listener.EventListener;
import mvccpb.Kv.KeyValue;
@@ -57,26 +59,27 @@
*/
public final class EtcdRegistryCenter implements RegistryCenter {
- private final EtcdConfiguration etcdConfig;
+ private RegistryCenterConfiguration config;
- private final EtcdRetryEngine etcdRetryEngine;
+ private EtcdRetryEngine etcdRetryEngine;
- private final KVFutureStub kvStub;
+ private KVFutureStub kvStub;
- private final LeaseFutureStub leaseStub;
+ private LeaseFutureStub leaseStub;
- private final WatchStub watchStub;
+ private WatchStub watchStub;
- private final KeepAlive keepAlive;
+ private KeepAlive keepAlive;
- public EtcdRegistryCenter(final EtcdConfiguration etcdConfig) {
- this.etcdConfig = etcdConfig;
- etcdRetryEngine = new EtcdRetryEngine(etcdConfig);
- Channel channel = EtcdChannelFactory.getInstance(Arrays.asList(etcdConfig.getServerLists().split(",")));
+ @Override
+ public void init(final RegistryCenterConfiguration config) {
+ this.config = config;
+ etcdRetryEngine = new EtcdRetryEngine(config);
+ Channel channel = EtcdChannelFactory.getInstance(Splitter.on(',').trimResults().splitToList(config.getServerLists()));
kvStub = KVGrpc.newFutureStub(channel);
leaseStub = LeaseGrpc.newFutureStub(channel);
watchStub = WatchGrpc.newStub(channel);
- keepAlive = new KeepAlive(channel, etcdConfig.getTimeToLiveSeconds());
+ keepAlive = new KeepAlive(channel, config.getTimeToLiveSeconds());
}
@Override
@@ -86,7 +89,7 @@ public String get(final String key) {
@Override
public String call() throws InterruptedException, ExecutionException, TimeoutException {
- RangeResponse response = kvStub.range(request).get(etcdConfig.getTimeoutMilliseconds(), TimeUnit.MILLISECONDS);
+ RangeResponse response = kvStub.range(request).get(config.getOperationTimeoutMilliseconds(), TimeUnit.MILLISECONDS);
return response.getKvsCount() > 0 ? response.getKvs(0).getValue().toStringUtf8() : null;
}
}).orNull();
@@ -110,7 +113,7 @@ public List getChildrenKeys(final String key) {
@Override
public List call() throws InterruptedException, ExecutionException, TimeoutException {
- RangeResponse response = kvStub.range(request).get(etcdConfig.getTimeoutMilliseconds(), TimeUnit.MILLISECONDS);
+ RangeResponse response = kvStub.range(request).get(config.getOperationTimeoutMilliseconds(), TimeUnit.MILLISECONDS);
List result = new ArrayList<>();
for (KeyValue each : response.getKvsList()) {
String childFullPath = each.getKey().toStringUtf8();
@@ -129,7 +132,7 @@ public void persist(final String key, final String value) {
@Override
public Void call() throws InterruptedException, ExecutionException, TimeoutException {
- kvStub.put(request).get(etcdConfig.getTimeoutMilliseconds(), TimeUnit.MILLISECONDS);
+ kvStub.put(request).get(config.getOperationTimeoutMilliseconds(), TimeUnit.MILLISECONDS);
return null;
}
});
@@ -144,26 +147,26 @@ public void update(final String key, final String value) {
public void persistEphemeral(final String key, final String value) {
final Optional leaseId = lease();
if (!leaseId.isPresent()) {
- throw new RegException("Unable to set up heat beat for key %s", key);
+ throw new RegistryCenterException("Unable to set up heat beat for key %s", key);
}
final PutRequest request = PutRequest.newBuilder().setPrevKv(true).setLease(leaseId.get()).setKey(ByteString.copyFromUtf8(key)).setValue(ByteString.copyFromUtf8(value)).build();
etcdRetryEngine.execute(new Callable() {
@Override
public Void call() throws InterruptedException, ExecutionException, TimeoutException {
- kvStub.put(request).get(etcdConfig.getTimeoutMilliseconds(), TimeUnit.MILLISECONDS);
+ kvStub.put(request).get(config.getOperationTimeoutMilliseconds(), TimeUnit.MILLISECONDS);
return null;
}
});
}
private Optional lease() {
- final LeaseGrantRequest request = LeaseGrantRequest.newBuilder().setTTL(etcdConfig.getTimeToLiveSeconds()).build();
+ final LeaseGrantRequest request = LeaseGrantRequest.newBuilder().setTTL(config.getTimeToLiveSeconds()).build();
return etcdRetryEngine.execute(new Callable() {
@Override
public Long call() throws InterruptedException, ExecutionException, TimeoutException {
- long leaseId = leaseStub.leaseGrant(request).get(etcdConfig.getTimeoutMilliseconds(), TimeUnit.MILLISECONDS).getID();
+ long leaseId = leaseStub.leaseGrant(request).get(config.getOperationTimeoutMilliseconds(), TimeUnit.MILLISECONDS).getID();
keepAlive.heartbeat(leaseId);
return leaseId;
}
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/etcd/internal/channel/EtcdChannelFactory.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-etcd/src/main/java/io/shardingsphere/orchestration/reg/etcd/internal/channel/EtcdChannelFactory.java
similarity index 100%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/etcd/internal/channel/EtcdChannelFactory.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-etcd/src/main/java/io/shardingsphere/orchestration/reg/etcd/internal/channel/EtcdChannelFactory.java
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/etcd/internal/channel/EtcdNameSolverFactory.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-etcd/src/main/java/io/shardingsphere/orchestration/reg/etcd/internal/channel/EtcdNameSolverFactory.java
similarity index 100%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/etcd/internal/channel/EtcdNameSolverFactory.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-etcd/src/main/java/io/shardingsphere/orchestration/reg/etcd/internal/channel/EtcdNameSolverFactory.java
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/etcd/internal/keepalive/KeepAlive.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-etcd/src/main/java/io/shardingsphere/orchestration/reg/etcd/internal/keepalive/KeepAlive.java
similarity index 100%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/etcd/internal/keepalive/KeepAlive.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-etcd/src/main/java/io/shardingsphere/orchestration/reg/etcd/internal/keepalive/KeepAlive.java
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/etcd/internal/retry/EtcdRetryEngine.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-etcd/src/main/java/io/shardingsphere/orchestration/reg/etcd/internal/retry/EtcdRetryEngine.java
similarity index 82%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/etcd/internal/retry/EtcdRetryEngine.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-etcd/src/main/java/io/shardingsphere/orchestration/reg/etcd/internal/retry/EtcdRetryEngine.java
index b96ba9c43055b..0b24283a140aa 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/etcd/internal/retry/EtcdRetryEngine.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-etcd/src/main/java/io/shardingsphere/orchestration/reg/etcd/internal/retry/EtcdRetryEngine.java
@@ -23,8 +23,8 @@
import com.github.rholder.retry.StopStrategies;
import com.github.rholder.retry.WaitStrategies;
import com.google.common.base.Optional;
-import io.shardingsphere.orchestration.reg.etcd.EtcdConfiguration;
-import io.shardingsphere.orchestration.reg.exception.RegExceptionHandler;
+import io.shardingsphere.orchestration.reg.api.RegistryCenterConfiguration;
+import io.shardingsphere.orchestration.reg.exception.RegistryCenterException;
import lombok.RequiredArgsConstructor;
import java.util.concurrent.Callable;
@@ -40,7 +40,7 @@
@RequiredArgsConstructor
public final class EtcdRetryEngine {
- private final EtcdConfiguration etcdConfig;
+ private final RegistryCenterConfiguration config;
/**
* Retry to execute callable command.
@@ -54,14 +54,13 @@ public Optional execute(final Callable callable) {
.retryIfExceptionOfType(TimeoutException.class)
.retryIfExceptionOfType(ExecutionException.class)
.retryIfExceptionOfType(InterruptedException.class)
- .withWaitStrategy(WaitStrategies.fixedWait(etcdConfig.getRetryIntervalMilliseconds(), TimeUnit.MILLISECONDS))
- .withStopStrategy(StopStrategies.stopAfterAttempt(etcdConfig.getMaxRetries()))
+ .withWaitStrategy(WaitStrategies.fixedWait(config.getRetryIntervalMilliseconds(), TimeUnit.MILLISECONDS))
+ .withStopStrategy(StopStrategies.stopAfterAttempt(config.getMaxRetries()))
.build();
try {
return Optional.fromNullable(retryer.call(callable));
} catch (final ExecutionException | RetryException ex) {
- RegExceptionHandler.handleException(ex);
- return Optional.absent();
+ throw new RegistryCenterException(ex);
}
}
}
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/etcd/internal/watcher/EtcdWatchStreamObserver.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-etcd/src/main/java/io/shardingsphere/orchestration/reg/etcd/internal/watcher/EtcdWatchStreamObserver.java
similarity index 93%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/etcd/internal/watcher/EtcdWatchStreamObserver.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-etcd/src/main/java/io/shardingsphere/orchestration/reg/etcd/internal/watcher/EtcdWatchStreamObserver.java
index 8364bfb3d7918..aec264632b767 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/etcd/internal/watcher/EtcdWatchStreamObserver.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-etcd/src/main/java/io/shardingsphere/orchestration/reg/etcd/internal/watcher/EtcdWatchStreamObserver.java
@@ -20,7 +20,7 @@
import etcdserverpb.Rpc;
import etcdserverpb.Rpc.WatchResponse;
import io.grpc.stub.StreamObserver;
-import io.shardingsphere.orchestration.reg.exception.RegException;
+import io.shardingsphere.orchestration.reg.exception.RegistryCenterException;
import io.shardingsphere.orchestration.reg.listener.DataChangedEvent;
import io.shardingsphere.orchestration.reg.listener.EventListener;
import lombok.RequiredArgsConstructor;
@@ -60,7 +60,7 @@ private DataChangedEvent.Type getEventType(final Event event) {
@Override
public void onError(final Throwable throwable) {
// TODO retry watch later
- throw new RegException(new Exception(throwable));
+ throw new RegistryCenterException(new Exception(throwable));
}
@Override
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/proto/etcd/auth/authpb/auth.proto b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-etcd/src/main/proto/etcd/auth/authpb/auth.proto
similarity index 100%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/proto/etcd/auth/authpb/auth.proto
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-etcd/src/main/proto/etcd/auth/authpb/auth.proto
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/proto/etcd/etcdserver/etcdserverpb/rpc.proto b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-etcd/src/main/proto/etcd/etcdserver/etcdserverpb/rpc.proto
similarity index 100%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/proto/etcd/etcdserver/etcdserverpb/rpc.proto
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-etcd/src/main/proto/etcd/etcdserver/etcdserverpb/rpc.proto
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/proto/etcd/mvcc/mvccpb/kv.proto b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-etcd/src/main/proto/etcd/mvcc/mvccpb/kv.proto
similarity index 100%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/proto/etcd/mvcc/mvccpb/kv.proto
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-etcd/src/main/proto/etcd/mvcc/mvccpb/kv.proto
diff --git a/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-etcd/src/main/resources/META-INF/services/io.shardingsphere.orchestration.reg.api.RegistryCenter b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-etcd/src/main/resources/META-INF/services/io.shardingsphere.orchestration.reg.api.RegistryCenter
new file mode 100644
index 0000000000000..044b1c669c127
--- /dev/null
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-etcd/src/main/resources/META-INF/services/io.shardingsphere.orchestration.reg.api.RegistryCenter
@@ -0,0 +1 @@
+io.shardingsphere.orchestration.reg.etcd.EtcdRegistryCenter
diff --git a/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/pom.xml b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/pom.xml
new file mode 100644
index 0000000000000..8d4de8deca0b1
--- /dev/null
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/pom.xml
@@ -0,0 +1,30 @@
+
+
+ 4.0.0
+
+ io.shardingsphere
+ sharding-orchestration-reg
+ 3.0.0.M5-SNAPSHOT
+
+ sharding-orchestration-reg-native-zookeeper
+
+
+
+ io.shardingsphere
+ sharding-orchestration-reg-api
+ ${project.version}
+
+
+
+ org.apache.zookeeper
+ zookeeper
+
+
+
+ org.apache.curator
+ curator-test
+
+
+
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/exception/RegExceptionHandler.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/NativeZookeeperExceptionHandler.java
similarity index 84%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/exception/RegExceptionHandler.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/NativeZookeeperExceptionHandler.java
index 071b3b2f07a1e..5285bf94713d1 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/exception/RegExceptionHandler.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/NativeZookeeperExceptionHandler.java
@@ -15,8 +15,9 @@
*
*/
-package io.shardingsphere.orchestration.reg.exception;
+package io.shardingsphere.orchestration.reg.zookeeper.natived;
+import io.shardingsphere.orchestration.reg.exception.RegistryCenterException;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -25,20 +26,20 @@
import org.apache.zookeeper.KeeperException.NodeExistsException;
/**
- * Registry center exception handler.
+ * Native zookeeper exception handler.
*
* @author zhangliang
*/
@Slf4j
@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class RegExceptionHandler {
+public final class NativeZookeeperExceptionHandler {
/**
* Handle exception.
*
* Ignore interrupt and connection invalid exception.
*
- * @param cause to be handled exception.
+ * @param cause to be handled exception
*/
public static void handleException(final Exception cause) {
if (null == cause) {
@@ -49,7 +50,7 @@ public static void handleException(final Exception cause) {
} else if (cause instanceof InterruptedException) {
Thread.currentThread().interrupt();
} else {
- throw new RegException(cause);
+ throw new RegistryCenterException(cause);
}
}
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/NewZookeeperRegistryCenter.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/NativeZookeeperRegistryCenter.java
similarity index 72%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/NewZookeeperRegistryCenter.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/NativeZookeeperRegistryCenter.java
index ca71d95a85856..2cc8ba1224b52 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/NewZookeeperRegistryCenter.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/NativeZookeeperRegistryCenter.java
@@ -15,23 +15,22 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk;
+package io.shardingsphere.orchestration.reg.zookeeper.natived;
import com.google.common.base.Charsets;
import com.google.common.base.Optional;
import com.google.common.base.Strings;
import io.shardingsphere.orchestration.reg.api.RegistryCenter;
-import io.shardingsphere.orchestration.reg.exception.RegExceptionHandler;
+import io.shardingsphere.orchestration.reg.api.RegistryCenterConfiguration;
import io.shardingsphere.orchestration.reg.listener.DataChangedEvent;
import io.shardingsphere.orchestration.reg.listener.EventListener;
-import io.shardingsphere.orchestration.reg.newzk.client.action.IClient;
-import io.shardingsphere.orchestration.reg.newzk.client.cache.PathTree;
-import io.shardingsphere.orchestration.reg.newzk.client.retry.DelayRetryPolicy;
-import io.shardingsphere.orchestration.reg.newzk.client.utility.ZookeeperConstants;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.ClientFactory;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.section.StrategyType;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.section.ZookeeperEventListener;
-import io.shardingsphere.orchestration.reg.zookeeper.ZookeeperConfiguration;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.action.IClient;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.cache.PathTree;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.retry.DelayRetryPolicy;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.utility.ZookeeperConstants;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.ClientFactory;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.section.StrategyType;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.section.ZookeeperEventListener;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.WatchedEvent;
@@ -47,44 +46,44 @@
import java.util.concurrent.TimeUnit;
/**
- * Zookeeper native based registry center.
+ * Registry center for native zookeeper.
*
* @author lidongbo
*/
-public final class NewZookeeperRegistryCenter implements RegistryCenter {
+public final class NativeZookeeperRegistryCenter implements RegistryCenter {
- private final IClient client;
+ private final Map caches = new HashMap<>();
- private final Map caches;
+ private IClient client;
- public NewZookeeperRegistryCenter(final ZookeeperConfiguration zkConfig) {
- client = initClient(buildClientFactory(zkConfig), zkConfig);
- caches = new HashMap<>();
+ @Override
+ public void init(final RegistryCenterConfiguration config) {
+ client = initClient(buildClientFactory(config), config);
}
- private ClientFactory buildClientFactory(final ZookeeperConfiguration zkConfig) {
+ private ClientFactory buildClientFactory(final RegistryCenterConfiguration config) {
ClientFactory result = new ClientFactory();
- result.setClientNamespace(zkConfig.getNamespace()).newClient(zkConfig.getServerLists(), zkConfig.getSessionTimeoutMilliseconds())
- .setRetryPolicy(new DelayRetryPolicy(zkConfig.getBaseSleepTimeMilliseconds(), zkConfig.getMaxRetries(), zkConfig.getMaxSleepTimeMilliseconds()));
- if (!Strings.isNullOrEmpty(zkConfig.getDigest())) {
- result.authorization("digest", zkConfig.getDigest().getBytes(Charsets.UTF_8), ZooDefs.Ids.CREATOR_ALL_ACL);
+ result.setClientNamespace(config.getNamespace()).newClient(config.getServerLists(), config.getTimeToLiveSeconds() * 1000)
+ .setRetryPolicy(new DelayRetryPolicy(config.getRetryIntervalMilliseconds(), config.getMaxRetries(), config.getRetryIntervalMilliseconds()));
+ if (!Strings.isNullOrEmpty(config.getDigest())) {
+ result.authorization("digest", config.getDigest().getBytes(Charsets.UTF_8), ZooDefs.Ids.CREATOR_ALL_ACL);
}
return result;
}
- private IClient initClient(final ClientFactory clientFactory, final ZookeeperConfiguration zkConfig) {
+ private IClient initClient(final ClientFactory clientFactory, final RegistryCenterConfiguration config) {
IClient result = null;
try {
// TODO There is a bug when the start time is very short, and I haven't found the reason yet
- // result = clientFactory.start(zkConfig.getMaxSleepTimeMilliseconds() * zkConfig.getMaxRetries(), TimeUnit.MILLISECONDS);
+ // result = clientFactory.start(config.getRetryIntervalMilliseconds() * config.getMaxRetries(), TimeUnit.MILLISECONDS);
result = clientFactory.start();
- if (!result.blockUntilConnected(zkConfig.getMaxSleepTimeMilliseconds() * zkConfig.getMaxRetries(), TimeUnit.MILLISECONDS)) {
+ if (!result.blockUntilConnected(config.getRetryIntervalMilliseconds() * config.getMaxRetries(), TimeUnit.MILLISECONDS)) {
result.close();
throw new KeeperException.OperationTimeoutException();
}
result.useExecStrategy(StrategyType.SYNC_RETRY);
} catch (final KeeperException.OperationTimeoutException | IOException | InterruptedException ex) {
- RegExceptionHandler.handleException(ex);
+ NativeZookeeperExceptionHandler.handleException(ex);
}
return result;
}
@@ -116,7 +115,7 @@ public String getDirectly(final String key) {
try {
return new String(client.getData(key), Charsets.UTF_8);
} catch (final KeeperException | InterruptedException ex) {
- RegExceptionHandler.handleException(ex);
+ NativeZookeeperExceptionHandler.handleException(ex);
return null;
}
}
@@ -126,7 +125,7 @@ public boolean isExisted(final String key) {
try {
return client.checkExists(key);
} catch (final KeeperException | InterruptedException ex) {
- RegExceptionHandler.handleException(ex);
+ NativeZookeeperExceptionHandler.handleException(ex);
return false;
}
}
@@ -144,7 +143,7 @@ public int compare(final String o1, final String o2) {
});
return result;
} catch (final KeeperException | InterruptedException ex) {
- RegExceptionHandler.handleException(ex);
+ NativeZookeeperExceptionHandler.handleException(ex);
return Collections.emptyList();
}
}
@@ -158,7 +157,7 @@ public void persist(final String key, final String value) {
update(key, value);
}
} catch (final KeeperException | InterruptedException ex) {
- RegExceptionHandler.handleException(ex);
+ NativeZookeeperExceptionHandler.handleException(ex);
}
}
@@ -167,7 +166,7 @@ public void update(final String key, final String value) {
try {
client.transaction().check(key, ZookeeperConstants.VERSION).setData(key, value.getBytes(ZookeeperConstants.UTF_8), ZookeeperConstants.VERSION).commit();
} catch (final KeeperException | InterruptedException ex) {
- RegExceptionHandler.handleException(ex);
+ NativeZookeeperExceptionHandler.handleException(ex);
}
}
@@ -179,7 +178,7 @@ public void persistEphemeral(final String key, final String value) {
}
client.createAllNeedPath(key, value, CreateMode.EPHEMERAL);
} catch (final KeeperException | InterruptedException ex) {
- RegExceptionHandler.handleException(ex);
+ NativeZookeeperExceptionHandler.handleException(ex);
}
}
@@ -220,7 +219,7 @@ private synchronized String getWithoutCache(final String key) {
client.useExecStrategy(StrategyType.SYNC_RETRY);
return null == data ? null : new String(data, Charsets.UTF_8);
} catch (final KeeperException | InterruptedException ex) {
- RegExceptionHandler.handleException(ex);
+ NativeZookeeperExceptionHandler.handleException(ex);
return null;
}
}
@@ -231,7 +230,7 @@ private void addCacheData(final String cachePath) {
cache.load();
cache.watch();
} catch (final KeeperException | InterruptedException ex) {
- RegExceptionHandler.handleException(ex);
+ NativeZookeeperExceptionHandler.handleException(ex);
}
caches.put(cachePath + "/", cache);
}
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/action/ContentionCallback.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/action/ContentionCallback.java
similarity index 91%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/action/ContentionCallback.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/action/ContentionCallback.java
index 37c68212ec9eb..83c42baf9d1c5 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/action/ContentionCallback.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/action/ContentionCallback.java
@@ -15,7 +15,7 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.action;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.action;
/**
* Callback on contention has not reached.
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/action/IAction.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/action/IAction.java
similarity index 98%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/action/IAction.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/action/IAction.java
index 4604b1acfd92d..f0c119ab282e2 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/action/IAction.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/action/IAction.java
@@ -15,7 +15,7 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.action;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.action;
import org.apache.zookeeper.AsyncCallback;
import org.apache.zookeeper.CreateMode;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/action/IClient.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/action/IClient.java
similarity index 86%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/action/IClient.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/action/IClient.java
index 42f705ca64b29..2be97e81032f7 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/action/IClient.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/action/IClient.java
@@ -15,11 +15,11 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.action;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.action;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.section.StrategyType;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.section.ZookeeperEventListener;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.transaction.BaseTransaction;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.section.StrategyType;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.section.ZookeeperEventListener;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.transaction.BaseTransaction;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/action/IExecStrategy.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/action/IExecStrategy.java
similarity index 84%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/action/IExecStrategy.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/action/IExecStrategy.java
index dc4ba7a396c49..48337ffd384c3 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/action/IExecStrategy.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/action/IExecStrategy.java
@@ -15,9 +15,9 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.action;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.action;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.transaction.BaseTransaction;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.transaction.BaseTransaction;
/**
* Client 's execution strategy.
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/action/IGroupAction.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/action/IGroupAction.java
similarity index 96%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/action/IGroupAction.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/action/IGroupAction.java
index 2957c9bbdcae1..c8acd37e759a0 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/action/IGroupAction.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/action/IGroupAction.java
@@ -15,7 +15,7 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.action;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.action;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/action/IProvider.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/action/IProvider.java
similarity index 94%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/action/IProvider.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/action/IProvider.java
index aeaceeed26142..161f6d78cee9b 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/action/IProvider.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/action/IProvider.java
@@ -15,10 +15,10 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.action;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.action;
-import io.shardingsphere.orchestration.reg.newzk.client.election.LeaderElection;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.transaction.BaseTransaction;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.election.LeaderElection;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.transaction.BaseTransaction;
import org.apache.zookeeper.AsyncCallback;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/action/ITransactionProvider.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/action/ITransactionProvider.java
similarity index 85%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/action/ITransactionProvider.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/action/ITransactionProvider.java
index 50e04dbad2325..11ad6590504b7 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/action/ITransactionProvider.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/action/ITransactionProvider.java
@@ -15,9 +15,9 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.action;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.action;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.transaction.BaseTransaction;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.transaction.BaseTransaction;
import org.apache.zookeeper.CreateMode;
/**
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/cache/CacheStrategy.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/cache/CacheStrategy.java
similarity index 90%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/cache/CacheStrategy.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/cache/CacheStrategy.java
index 4aec445dca5c9..a725bf1a7f19e 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/cache/CacheStrategy.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/cache/CacheStrategy.java
@@ -15,7 +15,7 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.cache;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.cache;
/**
* Cache strategy.
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/cache/PathNode.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/cache/PathNode.java
similarity index 91%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/cache/PathNode.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/cache/PathNode.java
index d1beee0daa78d..d587a7e667759 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/cache/PathNode.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/cache/PathNode.java
@@ -15,10 +15,10 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.cache;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.cache;
-import io.shardingsphere.orchestration.reg.newzk.client.utility.PathUtil;
-import io.shardingsphere.orchestration.reg.newzk.client.utility.ZookeeperConstants;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.utility.PathUtil;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.utility.ZookeeperConstants;
import lombok.Getter;
import lombok.Setter;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/cache/PathResolve.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/cache/PathResolve.java
similarity index 95%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/cache/PathResolve.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/cache/PathResolve.java
index 556ebc2b001d7..0d4d1801143b1 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/cache/PathResolve.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/cache/PathResolve.java
@@ -15,7 +15,7 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.cache;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.cache;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/cache/PathStatus.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/cache/PathStatus.java
similarity index 90%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/cache/PathStatus.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/cache/PathStatus.java
index 3c57d9188f1e5..96332e691c4fb 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/cache/PathStatus.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/cache/PathStatus.java
@@ -15,7 +15,7 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.cache;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.cache;
/**
* Path status.
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/cache/PathTree.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/cache/PathTree.java
similarity index 95%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/cache/PathTree.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/cache/PathTree.java
index 80a3f1a4ec9f3..12634e85fc3a3 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/cache/PathTree.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/cache/PathTree.java
@@ -15,15 +15,15 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.cache;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.cache;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
-import io.shardingsphere.orchestration.reg.newzk.client.action.IClient;
-import io.shardingsphere.orchestration.reg.newzk.client.action.IProvider;
-import io.shardingsphere.orchestration.reg.newzk.client.utility.PathUtil;
-import io.shardingsphere.orchestration.reg.newzk.client.utility.ZookeeperConstants;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.section.ZookeeperEventListener;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.action.IClient;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.action.IProvider;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.utility.PathUtil;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.utility.ZookeeperConstants;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.section.ZookeeperEventListener;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/election/LeaderElection.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/election/LeaderElection.java
similarity index 87%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/election/LeaderElection.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/election/LeaderElection.java
index 2927b4eec11b5..4ee4bdea03707 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/election/LeaderElection.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/election/LeaderElection.java
@@ -15,13 +15,13 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.election;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.election;
-import io.shardingsphere.orchestration.reg.newzk.client.action.IProvider;
-import io.shardingsphere.orchestration.reg.newzk.client.utility.PathUtil;
-import io.shardingsphere.orchestration.reg.newzk.client.utility.ZookeeperConstants;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.section.WatcherCreator;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.section.ZookeeperEventListener;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.action.IProvider;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.utility.PathUtil;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.utility.ZookeeperConstants;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.section.WatcherCreator;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.section.ZookeeperEventListener;
import lombok.extern.slf4j.Slf4j;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/retry/AsyncRetryCenter.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/retry/AsyncRetryCenter.java
similarity index 91%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/retry/AsyncRetryCenter.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/retry/AsyncRetryCenter.java
index 24ec2416b13c2..a2b21f2f70238 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/retry/AsyncRetryCenter.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/retry/AsyncRetryCenter.java
@@ -15,9 +15,9 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.retry;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.retry;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.base.BaseOperation;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.base.BaseOperation;
import java.util.concurrent.DelayQueue;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/retry/DelayPolicyExecutor.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/retry/DelayPolicyExecutor.java
similarity index 95%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/retry/DelayPolicyExecutor.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/retry/DelayPolicyExecutor.java
index dc4fdc1d90d34..ade08f607f959 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/retry/DelayPolicyExecutor.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/retry/DelayPolicyExecutor.java
@@ -15,7 +15,7 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.retry;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.retry;
import lombok.RequiredArgsConstructor;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/retry/DelayRetryPolicy.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/retry/DelayRetryPolicy.java
similarity index 94%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/retry/DelayRetryPolicy.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/retry/DelayRetryPolicy.java
index 8e13f1c62280c..0187fc21b0d8c 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/retry/DelayRetryPolicy.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/retry/DelayRetryPolicy.java
@@ -15,7 +15,7 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.retry;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.retry;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/retry/RetryCallable.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/retry/RetryCallable.java
similarity index 89%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/retry/RetryCallable.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/retry/RetryCallable.java
index a8dc4c01e8520..ded980ce40c8a 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/retry/RetryCallable.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/retry/RetryCallable.java
@@ -15,10 +15,10 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.retry;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.retry;
-import io.shardingsphere.orchestration.reg.newzk.client.action.IProvider;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.section.Connection;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.action.IProvider;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.section.Connection;
import lombok.AccessLevel;
import lombok.Getter;
import org.apache.zookeeper.KeeperException;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/retry/RetryResultCallable.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/retry/RetryResultCallable.java
similarity index 89%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/retry/RetryResultCallable.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/retry/RetryResultCallable.java
index 920ab382fb930..5f0570e86b28f 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/retry/RetryResultCallable.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/retry/RetryResultCallable.java
@@ -15,9 +15,9 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.retry;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.retry;
-import io.shardingsphere.orchestration.reg.newzk.client.action.IProvider;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.action.IProvider;
import lombok.Setter;
import org.apache.zookeeper.KeeperException;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/retry/RetryThread.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/retry/RetryThread.java
similarity index 95%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/retry/RetryThread.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/retry/RetryThread.java
index ae8c741888a7a..3b1ffba5fa7d0 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/retry/RetryThread.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/retry/RetryThread.java
@@ -15,9 +15,9 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.retry;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.retry;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.base.BaseOperation;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.base.BaseOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.zookeeper.KeeperException;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/utility/PathUtil.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/utility/PathUtil.java
similarity index 98%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/utility/PathUtil.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/utility/PathUtil.java
index f158ccbb1340f..8aa5baaa04bbe 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/utility/PathUtil.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/utility/PathUtil.java
@@ -15,7 +15,7 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.utility;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.utility;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/utility/ZookeeperConstants.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/utility/ZookeeperConstants.java
similarity index 95%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/utility/ZookeeperConstants.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/utility/ZookeeperConstants.java
index 8f86e3b766a0c..84de60548c1fb 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/utility/ZookeeperConstants.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/utility/ZookeeperConstants.java
@@ -15,7 +15,7 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.utility;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.utility;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/CacheClient.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/CacheClient.java
similarity index 88%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/CacheClient.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/CacheClient.java
index 8c9b1eb3e5402..37e2a9a7ced12 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/CacheClient.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/CacheClient.java
@@ -15,13 +15,13 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.zookeeper;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper;
-import io.shardingsphere.orchestration.reg.newzk.client.cache.CacheStrategy;
-import io.shardingsphere.orchestration.reg.newzk.client.cache.PathTree;
-import io.shardingsphere.orchestration.reg.newzk.client.utility.PathUtil;
-import io.shardingsphere.orchestration.reg.newzk.client.utility.ZookeeperConstants;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.base.BaseContext;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.cache.CacheStrategy;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.cache.PathTree;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.utility.PathUtil;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.utility.ZookeeperConstants;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.base.BaseContext;
import org.apache.zookeeper.AsyncCallback;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/ClientFactory.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/ClientFactory.java
similarity index 83%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/ClientFactory.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/ClientFactory.java
index 38920c238cec0..b4e208e2346c2 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/ClientFactory.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/ClientFactory.java
@@ -15,15 +15,15 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.zookeeper;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper;
-import io.shardingsphere.orchestration.reg.newzk.client.action.IClient;
-import io.shardingsphere.orchestration.reg.newzk.client.retry.DelayRetryPolicy;
-import io.shardingsphere.orchestration.reg.newzk.client.utility.PathUtil;
-import io.shardingsphere.orchestration.reg.newzk.client.utility.ZookeeperConstants;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.base.BaseClientFactory;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.section.ClientContext;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.section.ZookeeperEventListener;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.action.IClient;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.retry.DelayRetryPolicy;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.utility.PathUtil;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.utility.ZookeeperConstants;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.base.BaseClientFactory;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.section.ClientContext;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.section.ZookeeperEventListener;
import org.apache.zookeeper.data.ACL;
import java.io.IOException;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/UsualClient.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/UsualClient.java
similarity index 79%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/UsualClient.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/UsualClient.java
index 6b0569a48e198..f6bd9593dbc7c 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/UsualClient.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/UsualClient.java
@@ -15,22 +15,22 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.zookeeper;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper;
-import io.shardingsphere.orchestration.reg.newzk.client.action.IExecStrategy;
-import io.shardingsphere.orchestration.reg.newzk.client.action.ITransactionProvider;
-import io.shardingsphere.orchestration.reg.newzk.client.utility.ZookeeperConstants;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.base.BaseClient;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.base.BaseContext;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.provider.TransactionProvider;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.section.ClientContext;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.section.StrategyType;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.strategy.AsyncRetryStrategy;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.strategy.ContentionStrategy;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.strategy.SyncRetryStrategy;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.strategy.TransactionContendStrategy;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.strategy.UsualStrategy;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.transaction.BaseTransaction;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.action.IExecStrategy;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.action.ITransactionProvider;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.utility.ZookeeperConstants;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.base.BaseClient;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.base.BaseContext;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.provider.TransactionProvider;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.section.ClientContext;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.section.StrategyType;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.strategy.AsyncRetryStrategy;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.strategy.ContentionStrategy;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.strategy.SyncRetryStrategy;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.strategy.TransactionContendStrategy;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.strategy.UsualStrategy;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.transaction.BaseTransaction;
import lombok.Getter;
import org.apache.zookeeper.AsyncCallback;
import org.apache.zookeeper.CreateMode;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/base/BaseClient.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/base/BaseClient.java
similarity index 89%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/base/BaseClient.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/base/BaseClient.java
index a97a0b5d67087..ad672a6b07b6e 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/base/BaseClient.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/base/BaseClient.java
@@ -15,15 +15,15 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.zookeeper.base;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.base;
import com.google.common.base.Strings;
-import io.shardingsphere.orchestration.reg.newzk.client.action.IClient;
-import io.shardingsphere.orchestration.reg.newzk.client.utility.PathUtil;
-import io.shardingsphere.orchestration.reg.newzk.client.utility.ZookeeperConstants;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.section.StrategyType;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.section.WatcherCreator;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.section.ZookeeperEventListener;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.action.IClient;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.utility.PathUtil;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.utility.ZookeeperConstants;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.section.StrategyType;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.section.WatcherCreator;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.section.ZookeeperEventListener;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/base/BaseClientFactory.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/base/BaseClientFactory.java
similarity index 90%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/base/BaseClientFactory.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/base/BaseClientFactory.java
index 1ef4e3bd88b45..c828f56da3d70 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/base/BaseClientFactory.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/base/BaseClientFactory.java
@@ -15,10 +15,10 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.zookeeper.base;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.base;
-import io.shardingsphere.orchestration.reg.newzk.client.action.IClient;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.section.ZookeeperEventListener;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.action.IClient;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.section.ZookeeperEventListener;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/base/BaseContext.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/base/BaseContext.java
similarity index 86%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/base/BaseContext.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/base/BaseContext.java
index a4e7a1006961f..33a428305e03b 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/base/BaseContext.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/base/BaseContext.java
@@ -15,9 +15,9 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.zookeeper.base;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.base;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.section.ZookeeperEventListener;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.section.ZookeeperEventListener;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/base/BaseOperation.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/base/BaseOperation.java
similarity index 86%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/base/BaseOperation.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/base/BaseOperation.java
index 9a873258cd901..350eec4f91211 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/base/BaseOperation.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/base/BaseOperation.java
@@ -15,11 +15,11 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.zookeeper.base;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.base;
-import io.shardingsphere.orchestration.reg.newzk.client.action.IProvider;
-import io.shardingsphere.orchestration.reg.newzk.client.retry.DelayPolicyExecutor;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.section.Connection;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.action.IProvider;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.retry.DelayPolicyExecutor;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.section.Connection;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/base/Holder.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/base/Holder.java
similarity index 96%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/base/Holder.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/base/Holder.java
index 33229aec1b488..5ee67a3d16af2 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/base/Holder.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/base/Holder.java
@@ -15,10 +15,10 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.zookeeper.base;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.base;
import com.google.common.base.Strings;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.section.ZookeeperEventListener;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.section.ZookeeperEventListener;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/operation/CreateAllNeedOperation.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/operation/CreateAllNeedOperation.java
similarity index 80%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/operation/CreateAllNeedOperation.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/operation/CreateAllNeedOperation.java
index 3da53f3ccf417..862362b9686f5 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/operation/CreateAllNeedOperation.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/operation/CreateAllNeedOperation.java
@@ -15,11 +15,11 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.zookeeper.operation;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.operation;
-import io.shardingsphere.orchestration.reg.newzk.client.action.IProvider;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.base.BaseOperation;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.strategy.UsualStrategy;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.action.IProvider;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.base.BaseOperation;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.strategy.UsualStrategy;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/operation/CreateCurrentOperation.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/operation/CreateCurrentOperation.java
similarity index 85%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/operation/CreateCurrentOperation.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/operation/CreateCurrentOperation.java
index 5335aad5e9d34..a7932cf96be12 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/operation/CreateCurrentOperation.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/operation/CreateCurrentOperation.java
@@ -15,10 +15,10 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.zookeeper.operation;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.operation;
-import io.shardingsphere.orchestration.reg.newzk.client.action.IProvider;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.base.BaseOperation;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.action.IProvider;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.base.BaseOperation;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/operation/DeleteAllChildrenOperation.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/operation/DeleteAllChildrenOperation.java
similarity index 77%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/operation/DeleteAllChildrenOperation.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/operation/DeleteAllChildrenOperation.java
index 189fa39280395..89cc17f964a19 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/operation/DeleteAllChildrenOperation.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/operation/DeleteAllChildrenOperation.java
@@ -15,11 +15,11 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.zookeeper.operation;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.operation;
-import io.shardingsphere.orchestration.reg.newzk.client.action.IProvider;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.base.BaseOperation;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.strategy.UsualStrategy;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.action.IProvider;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.base.BaseOperation;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.strategy.UsualStrategy;
import org.apache.zookeeper.KeeperException;
/**
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/operation/DeleteCurrentBranchOperation.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/operation/DeleteCurrentBranchOperation.java
similarity index 77%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/operation/DeleteCurrentBranchOperation.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/operation/DeleteCurrentBranchOperation.java
index 324bcc43a63bb..7c2fc30fe223c 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/operation/DeleteCurrentBranchOperation.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/operation/DeleteCurrentBranchOperation.java
@@ -15,11 +15,11 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.zookeeper.operation;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.operation;
-import io.shardingsphere.orchestration.reg.newzk.client.action.IProvider;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.base.BaseOperation;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.strategy.UsualStrategy;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.action.IProvider;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.base.BaseOperation;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.strategy.UsualStrategy;
import org.apache.zookeeper.KeeperException;
/**
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/operation/DeleteCurrentOperation.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/operation/DeleteCurrentOperation.java
similarity index 82%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/operation/DeleteCurrentOperation.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/operation/DeleteCurrentOperation.java
index 80de0d975a50a..d5eaf639ebf45 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/operation/DeleteCurrentOperation.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/operation/DeleteCurrentOperation.java
@@ -15,10 +15,10 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.zookeeper.operation;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.operation;
-import io.shardingsphere.orchestration.reg.newzk.client.action.IProvider;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.base.BaseOperation;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.action.IProvider;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.base.BaseOperation;
import org.apache.zookeeper.KeeperException;
/**
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/operation/UpdateOperation.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/operation/UpdateOperation.java
similarity index 83%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/operation/UpdateOperation.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/operation/UpdateOperation.java
index 5160b9db112b6..c2d6aa9f357c2 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/operation/UpdateOperation.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/operation/UpdateOperation.java
@@ -15,10 +15,10 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.zookeeper.operation;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.operation;
-import io.shardingsphere.orchestration.reg.newzk.client.action.IProvider;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.base.BaseOperation;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.action.IProvider;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.base.BaseOperation;
import org.apache.zookeeper.KeeperException;
/**
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/provider/BaseProvider.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/provider/BaseProvider.java
similarity index 88%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/provider/BaseProvider.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/provider/BaseProvider.java
index 9166cd708f7aa..529f93e613fc0 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/provider/BaseProvider.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/provider/BaseProvider.java
@@ -15,14 +15,14 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.zookeeper.provider;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.provider;
-import io.shardingsphere.orchestration.reg.newzk.client.action.IProvider;
-import io.shardingsphere.orchestration.reg.newzk.client.election.LeaderElection;
-import io.shardingsphere.orchestration.reg.newzk.client.utility.PathUtil;
-import io.shardingsphere.orchestration.reg.newzk.client.utility.ZookeeperConstants;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.base.Holder;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.transaction.BaseTransaction;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.action.IProvider;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.election.LeaderElection;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.utility.PathUtil;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.utility.ZookeeperConstants;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.base.Holder;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.transaction.BaseTransaction;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/provider/TransactionProvider.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/provider/TransactionProvider.java
similarity index 71%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/provider/TransactionProvider.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/provider/TransactionProvider.java
index 32caba92a9a34..93f003f7fa966 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/provider/TransactionProvider.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/provider/TransactionProvider.java
@@ -15,13 +15,13 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.zookeeper.provider;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.provider;
-import io.shardingsphere.orchestration.reg.newzk.client.action.ITransactionProvider;
-import io.shardingsphere.orchestration.reg.newzk.client.utility.ZookeeperConstants;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.base.Holder;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.transaction.BaseTransaction;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.transaction.ZooKeeperTransaction;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.action.ITransactionProvider;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.utility.ZookeeperConstants;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.base.Holder;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.transaction.BaseTransaction;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.transaction.ZooKeeperTransaction;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.data.ACL;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/section/ClientContext.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/section/ClientContext.java
similarity index 80%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/section/ClientContext.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/section/ClientContext.java
index 07bb8574c3050..dccc3093c4162 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/section/ClientContext.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/section/ClientContext.java
@@ -15,11 +15,11 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.zookeeper.section;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.section;
-import io.shardingsphere.orchestration.reg.newzk.client.retry.DelayRetryPolicy;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.base.BaseClientFactory;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.base.BaseContext;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.retry.DelayRetryPolicy;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.base.BaseClientFactory;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.base.BaseContext;
import lombok.Getter;
import lombok.Setter;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/section/ClientTask.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/section/ClientTask.java
similarity index 89%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/section/ClientTask.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/section/ClientTask.java
index a7949a3e01a2b..75415123dc229 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/section/ClientTask.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/section/ClientTask.java
@@ -15,9 +15,9 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.zookeeper.section;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.section;
-import io.shardingsphere.orchestration.reg.newzk.client.action.IProvider;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.action.IProvider;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.zookeeper.KeeperException;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/section/Connection.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/section/Connection.java
similarity index 96%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/section/Connection.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/section/Connection.java
index 81c639b9fc809..20cd367eea463 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/section/Connection.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/section/Connection.java
@@ -15,7 +15,7 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.zookeeper.section;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.section;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/section/StrategyType.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/section/StrategyType.java
similarity index 90%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/section/StrategyType.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/section/StrategyType.java
index ad558000655f2..0195de83c68fd 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/section/StrategyType.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/section/StrategyType.java
@@ -15,7 +15,7 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.zookeeper.section;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.section;
/**
* Exec strategy type.
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/section/WatcherCreator.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/section/WatcherCreator.java
similarity index 94%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/section/WatcherCreator.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/section/WatcherCreator.java
index e93aa88f5bb88..2dcea7832ca55 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/section/WatcherCreator.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/section/WatcherCreator.java
@@ -15,7 +15,7 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.zookeeper.section;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.section;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/section/ZookeeperEventListener.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/section/ZookeeperEventListener.java
similarity index 93%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/section/ZookeeperEventListener.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/section/ZookeeperEventListener.java
index fa56babef5425..f6b44f012add9 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/section/ZookeeperEventListener.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/section/ZookeeperEventListener.java
@@ -15,7 +15,7 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.zookeeper.section;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.section;
import lombok.Getter;
import lombok.Setter;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/strategy/AsyncRetryStrategy.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/strategy/AsyncRetryStrategy.java
similarity index 80%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/strategy/AsyncRetryStrategy.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/strategy/AsyncRetryStrategy.java
index 6e68d2812c1a3..13b5e6fce9b42 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/strategy/AsyncRetryStrategy.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/strategy/AsyncRetryStrategy.java
@@ -15,18 +15,18 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.zookeeper.strategy;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.strategy;
-import io.shardingsphere.orchestration.reg.newzk.client.action.IProvider;
-import io.shardingsphere.orchestration.reg.newzk.client.retry.AsyncRetryCenter;
-import io.shardingsphere.orchestration.reg.newzk.client.retry.DelayRetryPolicy;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.operation.CreateAllNeedOperation;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.operation.CreateCurrentOperation;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.operation.DeleteAllChildrenOperation;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.operation.DeleteCurrentBranchOperation;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.operation.DeleteCurrentOperation;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.operation.UpdateOperation;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.section.Connection;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.action.IProvider;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.retry.AsyncRetryCenter;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.retry.DelayRetryPolicy;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.operation.CreateAllNeedOperation;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.operation.CreateCurrentOperation;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.operation.DeleteAllChildrenOperation;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.operation.DeleteCurrentBranchOperation;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.operation.DeleteCurrentOperation;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.operation.UpdateOperation;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.section.Connection;
import lombok.extern.slf4j.Slf4j;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/strategy/BaseStrategy.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/strategy/BaseStrategy.java
similarity index 76%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/strategy/BaseStrategy.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/strategy/BaseStrategy.java
index fb09491cae70d..527b68ed12216 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/strategy/BaseStrategy.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/strategy/BaseStrategy.java
@@ -15,11 +15,11 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.zookeeper.strategy;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.strategy;
-import io.shardingsphere.orchestration.reg.newzk.client.action.IExecStrategy;
-import io.shardingsphere.orchestration.reg.newzk.client.action.IProvider;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.transaction.BaseTransaction;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.action.IExecStrategy;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.action.IProvider;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.transaction.BaseTransaction;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.apache.zookeeper.KeeperException;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/strategy/ContentionStrategy.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/strategy/ContentionStrategy.java
similarity index 94%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/strategy/ContentionStrategy.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/strategy/ContentionStrategy.java
index ba19753b9975c..8e26a1f736994 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/strategy/ContentionStrategy.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/strategy/ContentionStrategy.java
@@ -15,13 +15,13 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.zookeeper.strategy;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.strategy;
-import io.shardingsphere.orchestration.reg.newzk.client.action.ContentionCallback;
-import io.shardingsphere.orchestration.reg.newzk.client.action.IProvider;
-import io.shardingsphere.orchestration.reg.newzk.client.election.LeaderElection;
-import io.shardingsphere.orchestration.reg.newzk.client.utility.PathUtil;
-import io.shardingsphere.orchestration.reg.newzk.client.utility.ZookeeperConstants;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.action.ContentionCallback;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.action.IProvider;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.election.LeaderElection;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.utility.PathUtil;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.utility.ZookeeperConstants;
import lombok.extern.slf4j.Slf4j;
import org.apache.zookeeper.AsyncCallback;
import org.apache.zookeeper.CreateMode;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/strategy/SyncRetryStrategy.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/strategy/SyncRetryStrategy.java
similarity index 93%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/strategy/SyncRetryStrategy.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/strategy/SyncRetryStrategy.java
index ad6c4233aca4b..8f8f5f9ee6ab9 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/strategy/SyncRetryStrategy.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/strategy/SyncRetryStrategy.java
@@ -15,12 +15,12 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.zookeeper.strategy;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.strategy;
-import io.shardingsphere.orchestration.reg.newzk.client.action.IProvider;
-import io.shardingsphere.orchestration.reg.newzk.client.retry.DelayRetryPolicy;
-import io.shardingsphere.orchestration.reg.newzk.client.retry.RetryCallable;
-import io.shardingsphere.orchestration.reg.newzk.client.retry.RetryResultCallable;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.action.IProvider;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.retry.DelayRetryPolicy;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.retry.RetryCallable;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.retry.RetryResultCallable;
import lombok.AccessLevel;
import lombok.Getter;
import org.apache.zookeeper.CreateMode;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/strategy/TransactionContendStrategy.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/strategy/TransactionContendStrategy.java
similarity index 88%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/strategy/TransactionContendStrategy.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/strategy/TransactionContendStrategy.java
index 4babc3c4d78b3..edc64ac92196b 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/strategy/TransactionContendStrategy.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/strategy/TransactionContendStrategy.java
@@ -15,15 +15,15 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.zookeeper.strategy;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.strategy;
-import io.shardingsphere.orchestration.reg.newzk.client.action.ContentionCallback;
-import io.shardingsphere.orchestration.reg.newzk.client.action.ITransactionProvider;
-import io.shardingsphere.orchestration.reg.newzk.client.election.LeaderElection;
-import io.shardingsphere.orchestration.reg.newzk.client.utility.PathUtil;
-import io.shardingsphere.orchestration.reg.newzk.client.utility.ZookeeperConstants;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.provider.BaseProvider;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.transaction.ZooKeeperTransaction;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.action.ContentionCallback;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.action.ITransactionProvider;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.election.LeaderElection;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.utility.PathUtil;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.utility.ZookeeperConstants;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.provider.BaseProvider;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.transaction.ZooKeeperTransaction;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/strategy/UsualStrategy.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/strategy/UsualStrategy.java
similarity index 94%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/strategy/UsualStrategy.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/strategy/UsualStrategy.java
index 8d01d71edee12..697842cedbf10 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/strategy/UsualStrategy.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/strategy/UsualStrategy.java
@@ -15,11 +15,11 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.zookeeper.strategy;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.strategy;
-import io.shardingsphere.orchestration.reg.newzk.client.action.IProvider;
-import io.shardingsphere.orchestration.reg.newzk.client.utility.PathUtil;
-import io.shardingsphere.orchestration.reg.newzk.client.utility.ZookeeperConstants;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.action.IProvider;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.utility.PathUtil;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.utility.ZookeeperConstants;
import lombok.extern.slf4j.Slf4j;
import org.apache.zookeeper.AsyncCallback;
import org.apache.zookeeper.CreateMode;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/transaction/BaseTransaction.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/transaction/BaseTransaction.java
similarity index 97%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/transaction/BaseTransaction.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/transaction/BaseTransaction.java
index bcb7b8ab24c7e..390cc30819c6a 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/transaction/BaseTransaction.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/transaction/BaseTransaction.java
@@ -15,7 +15,7 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.zookeeper.transaction;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.transaction;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/transaction/ZooKeeperTransaction.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/transaction/ZooKeeperTransaction.java
similarity index 88%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/transaction/ZooKeeperTransaction.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/transaction/ZooKeeperTransaction.java
index 9c173a7013b59..2d99e7b2c512d 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/transaction/ZooKeeperTransaction.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/transaction/ZooKeeperTransaction.java
@@ -15,11 +15,11 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.zookeeper.transaction;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.transaction;
-import io.shardingsphere.orchestration.reg.newzk.client.utility.PathUtil;
-import io.shardingsphere.orchestration.reg.newzk.client.utility.ZookeeperConstants;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.base.Holder;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.utility.PathUtil;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.utility.ZookeeperConstants;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.base.Holder;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.OpResult;
diff --git a/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/resources/META-INF/services/io.shardingsphere.orchestration.reg.api.RegistryCenter b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/resources/META-INF/services/io.shardingsphere.orchestration.reg.api.RegistryCenter
new file mode 100644
index 0000000000000..9db828e8a6738
--- /dev/null
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/main/resources/META-INF/services/io.shardingsphere.orchestration.reg.api.RegistryCenter
@@ -0,0 +1 @@
+io.shardingsphere.orchestration.reg.zookeeper.natived.NativeZookeeperRegistryCenter
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/AllNewzkTests.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/AllNativeZookeeperTests.java
similarity index 61%
rename from sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/AllNewzkTests.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/AllNativeZookeeperTests.java
index 3fb169306c5ae..d2c9866739e60 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/AllNewzkTests.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/AllNativeZookeeperTests.java
@@ -15,13 +15,13 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk;
+package io.shardingsphere.orchestration.reg.zookeeper.natived;
-import io.shardingsphere.orchestration.reg.newzk.client.cache.PathResolveTest;
-import io.shardingsphere.orchestration.reg.newzk.client.cache.PathTreeTest;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.AllBaseTests;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.SyncRetryStrategyTest;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.UsualClientTest;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.cache.PathResolveTest;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.cache.PathTreeTest;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.AllBaseTests;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.SyncRetryStrategyTest;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.UsualClientTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@@ -34,5 +34,5 @@
AllBaseTests.class,
UsualClientTest.class
})
-public final class AllNewzkTests {
+public final class AllNativeZookeeperTests {
}
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/cache/PathResolveTest.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/cache/PathResolveTest.java
similarity index 96%
rename from sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/cache/PathResolveTest.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/cache/PathResolveTest.java
index e3db3364b4295..8cba2e815f46c 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/cache/PathResolveTest.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/cache/PathResolveTest.java
@@ -15,7 +15,7 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.cache;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.cache;
import org.junit.Test;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/cache/PathTreeTest.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/cache/PathTreeTest.java
similarity index 89%
rename from sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/cache/PathTreeTest.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/cache/PathTreeTest.java
index c5124baa5534e..1813d1e40e9ab 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/cache/PathTreeTest.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/cache/PathTreeTest.java
@@ -15,17 +15,18 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.cache;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.cache;
-import io.shardingsphere.orchestration.reg.newzk.client.action.IClient;
-import io.shardingsphere.orchestration.reg.newzk.client.util.EmbedTestingServer;
-import io.shardingsphere.orchestration.reg.newzk.client.utility.ZookeeperConstants;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.ClientFactory;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.base.BaseTest;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.base.TestSupport;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.action.IClient;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.util.EmbedTestingServer;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.utility.ZookeeperConstants;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.ClientFactory;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.base.BaseTest;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.base.TestSupport;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.ZooDefs;
+import org.hamcrest.CoreMatchers;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -109,7 +110,7 @@ public void assertPut() {
final String key = "a/b/bb";
final String value = "bbb11";
pathTree.put(key, value);
- assertThat(pathTree.getValue("a"), is(ZookeeperConstants.NOTHING_DATA));
+ assertThat(pathTree.getValue("a"), CoreMatchers.is(ZookeeperConstants.NOTHING_DATA));
assertThat(pathTree.getValue("a/b"), is(ZookeeperConstants.NOTHING_DATA));
assertThat(pathTree.getValue(key), is(value.getBytes(ZookeeperConstants.UTF_8)));
}
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/retry/TestCallable.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/retry/TestCallable.java
similarity index 85%
rename from sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/retry/TestCallable.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/retry/TestCallable.java
index 4a38639b507c3..d58431b2c7612 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/retry/TestCallable.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/retry/TestCallable.java
@@ -15,10 +15,10 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.retry;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.retry;
-import io.shardingsphere.orchestration.reg.newzk.client.action.IProvider;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.provider.BaseProvider;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.action.IProvider;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.provider.BaseProvider;
import org.apache.zookeeper.KeeperException;
public abstract class TestCallable extends RetryCallable {
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/retry/TestResultCallable.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/retry/TestResultCallable.java
similarity index 85%
rename from sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/retry/TestResultCallable.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/retry/TestResultCallable.java
index 82527e2162782..15bf4af5f832e 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/retry/TestResultCallable.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/retry/TestResultCallable.java
@@ -15,10 +15,10 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.retry;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.retry;
-import io.shardingsphere.orchestration.reg.newzk.client.action.IProvider;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.provider.BaseProvider;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.action.IProvider;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.provider.BaseProvider;
import org.apache.zookeeper.KeeperException;
public abstract class TestResultCallable extends RetryResultCallable {
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/util/EmbedTestingServer.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/util/EmbedTestingServer.java
similarity index 84%
rename from sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/util/EmbedTestingServer.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/util/EmbedTestingServer.java
index b75cdc067d34c..f3713472fdf67 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/util/EmbedTestingServer.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/util/EmbedTestingServer.java
@@ -15,9 +15,9 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.util;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.util;
-import io.shardingsphere.orchestration.reg.exception.RegExceptionHandler;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.NativeZookeeperExceptionHandler;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.curator.test.TestingServer;
@@ -44,7 +44,7 @@ public static void start() {
// CHECKSTYLE:OFF
} catch (final Exception ex) {
// CHECKSTYLE:ON
- RegExceptionHandler.handleException(ex);
+ NativeZookeeperExceptionHandler.handleException(ex);
} finally {
Runtime.getRuntime().addShutdownHook(new Thread() {
@@ -53,7 +53,7 @@ public void run() {
try {
testingServer.close();
} catch (final IOException ex) {
- RegExceptionHandler.handleException(ex);
+ NativeZookeeperExceptionHandler.handleException(ex);
}
}
});
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/AllBaseTests.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/AllBaseTests.java
similarity index 82%
rename from sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/AllBaseTests.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/AllBaseTests.java
index b9d3849538e07..f7a6a1c50c16f 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/AllBaseTests.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/AllBaseTests.java
@@ -15,9 +15,9 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.zookeeper;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.base.StartWaitTest;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.base.StartWaitTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/SyncRetryStrategyTest.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/SyncRetryStrategyTest.java
similarity index 91%
rename from sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/SyncRetryStrategyTest.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/SyncRetryStrategyTest.java
index 1e4a943e8b6e4..c68e6a78edb91 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/SyncRetryStrategyTest.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/SyncRetryStrategyTest.java
@@ -15,17 +15,17 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.zookeeper;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper;
-import io.shardingsphere.orchestration.reg.newzk.client.action.IClient;
-import io.shardingsphere.orchestration.reg.newzk.client.action.IProvider;
-import io.shardingsphere.orchestration.reg.newzk.client.retry.DelayRetryPolicy;
-import io.shardingsphere.orchestration.reg.newzk.client.retry.TestCallable;
-import io.shardingsphere.orchestration.reg.newzk.client.retry.TestResultCallable;
-import io.shardingsphere.orchestration.reg.newzk.client.utility.PathUtil;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.base.TestSupport;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.section.StrategyType;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.strategy.UsualStrategy;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.action.IClient;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.action.IProvider;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.retry.DelayRetryPolicy;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.retry.TestCallable;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.retry.TestResultCallable;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.utility.PathUtil;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.base.TestSupport;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.section.StrategyType;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.strategy.UsualStrategy;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.ZooDefs;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/UsualClientTest.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/UsualClientTest.java
similarity index 82%
rename from sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/UsualClientTest.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/UsualClientTest.java
index cffc72654e5d4..d1a30154c65eb 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/UsualClientTest.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/UsualClientTest.java
@@ -15,19 +15,19 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.zookeeper;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper;
-import io.shardingsphere.orchestration.reg.newzk.client.action.IClient;
-import io.shardingsphere.orchestration.reg.newzk.client.utility.ZookeeperConstants;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.base.BaseClientTest;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.base.TestSupport;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.section.StrategyType;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.strategy.AsyncRetryStrategy;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.strategy.ContentionStrategy;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.strategy.SyncRetryStrategy;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.strategy.TransactionContendStrategy;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.strategy.UsualStrategy;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.transaction.BaseTransaction;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.action.IClient;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.utility.ZookeeperConstants;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.base.BaseClientTest;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.base.TestSupport;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.section.StrategyType;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.strategy.AsyncRetryStrategy;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.strategy.ContentionStrategy;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.strategy.SyncRetryStrategy;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.strategy.TransactionContendStrategy;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.strategy.UsualStrategy;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.transaction.BaseTransaction;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.ZooDefs;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/base/BaseClientTest.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/base/BaseClientTest.java
similarity index 95%
rename from sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/base/BaseClientTest.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/base/BaseClientTest.java
index d1dc300669161..18f725adf0766 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/base/BaseClientTest.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/base/BaseClientTest.java
@@ -15,14 +15,14 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.zookeeper.base;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.base;
-import io.shardingsphere.orchestration.reg.newzk.client.action.IClient;
-import io.shardingsphere.orchestration.reg.newzk.client.util.EmbedTestingServer;
-import io.shardingsphere.orchestration.reg.newzk.client.utility.PathUtil;
-import io.shardingsphere.orchestration.reg.newzk.client.utility.ZookeeperConstants;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.ClientFactory;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.section.ZookeeperEventListener;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.action.IClient;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.util.EmbedTestingServer;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.utility.PathUtil;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.utility.ZookeeperConstants;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.ClientFactory;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.section.ZookeeperEventListener;
import lombok.Getter;
import org.apache.zookeeper.AsyncCallback;
import org.apache.zookeeper.CreateMode;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/base/BaseTest.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/base/BaseTest.java
similarity index 87%
rename from sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/base/BaseTest.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/base/BaseTest.java
index 480285a159352..4ef59decefb1a 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/base/BaseTest.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/base/BaseTest.java
@@ -15,9 +15,9 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.zookeeper.base;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.base;
-import io.shardingsphere.orchestration.reg.newzk.client.action.IClient;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.action.IClient;
import org.apache.zookeeper.KeeperException;
public class BaseTest {
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/base/StartWaitTest.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/base/StartWaitTest.java
similarity index 80%
rename from sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/base/StartWaitTest.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/base/StartWaitTest.java
index f1387b222b553..5f213fba77cbd 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/base/StartWaitTest.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/base/StartWaitTest.java
@@ -15,11 +15,11 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.zookeeper.base;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.base;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.section.ClientContext;
-import io.shardingsphere.orchestration.reg.newzk.client.action.IClient;
-import io.shardingsphere.orchestration.reg.newzk.client.util.EmbedTestingServer;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.action.IClient;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.util.EmbedTestingServer;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.section.ClientContext;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/base/TestClient.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/base/TestClient.java
similarity index 88%
rename from sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/base/TestClient.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/base/TestClient.java
index 574d3d702a4d8..04b44851895db 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/base/TestClient.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/base/TestClient.java
@@ -15,9 +15,9 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.zookeeper.base;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.base;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.UsualClient;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.UsualClient;
import org.apache.zookeeper.ZooKeeper;
import java.io.IOException;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/base/TestHolder.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/base/TestHolder.java
similarity index 95%
rename from sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/base/TestHolder.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/base/TestHolder.java
index 86b3fd6e9ccf2..1c5c760457f09 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/base/TestHolder.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/base/TestHolder.java
@@ -15,7 +15,7 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.zookeeper.base;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.base;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/base/TestSupport.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/base/TestSupport.java
similarity index 88%
rename from sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/base/TestSupport.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/base/TestSupport.java
index fe8dd857a2158..e75fdc9ac38d4 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/newzk/client/zookeeper/base/TestSupport.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/java/io/shardingsphere/orchestration/reg/zookeeper/natived/client/zookeeper/base/TestSupport.java
@@ -15,9 +15,9 @@
*
*/
-package io.shardingsphere.orchestration.reg.newzk.client.zookeeper.base;
+package io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.base;
-import io.shardingsphere.orchestration.reg.newzk.client.zookeeper.section.ZookeeperEventListener;
+import io.shardingsphere.orchestration.reg.zookeeper.natived.client.zookeeper.section.ZookeeperEventListener;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/test/resources/logback-test.xml b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/resources/logback-test.xml
similarity index 81%
rename from sharding-orchestration/sharding-orchestration-reg/src/test/resources/logback-test.xml
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/resources/logback-test.xml
index 1cb0de791ca6c..0ac5601568948 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/test/resources/logback-test.xml
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-native-zookeeper/src/test/resources/logback-test.xml
@@ -8,7 +8,7 @@
-
+
diff --git a/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-zookeeper-curator/pom.xml b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-zookeeper-curator/pom.xml
new file mode 100644
index 0000000000000..c1b0d55d6c893
--- /dev/null
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-zookeeper-curator/pom.xml
@@ -0,0 +1,33 @@
+
+
+ 4.0.0
+
+ io.shardingsphere
+ sharding-orchestration-reg
+ 3.0.0.M5-SNAPSHOT
+
+ sharding-orchestration-reg-zookeeper-curator
+
+
+
+ io.shardingsphere
+ sharding-orchestration-reg-api
+ ${project.version}
+
+
+
+ org.apache.curator
+ curator-framework
+
+
+ org.apache.curator
+ curator-client
+
+
+ org.apache.curator
+ curator-recipes
+
+
+
diff --git a/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-zookeeper-curator/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/curator/CuratorZookeeperExceptionHandler.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-zookeeper-curator/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/curator/CuratorZookeeperExceptionHandler.java
new file mode 100644
index 0000000000000..2cb0dc4752dcb
--- /dev/null
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-zookeeper-curator/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/curator/CuratorZookeeperExceptionHandler.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2016-2018 shardingsphere.io.
+ *
+ * Licensed 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 io.shardingsphere.orchestration.reg.zookeeper.curator;
+
+import io.shardingsphere.orchestration.reg.exception.RegistryCenterException;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.zookeeper.KeeperException.ConnectionLossException;
+import org.apache.zookeeper.KeeperException.NoNodeException;
+import org.apache.zookeeper.KeeperException.NodeExistsException;
+
+/**
+ * Curator zookeeper exception handler.
+ *
+ * @author zhangliang
+ */
+@Slf4j
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class CuratorZookeeperExceptionHandler {
+
+ /**
+ * Handle exception.
+ *
+ * Ignore interrupt and connection invalid exception.
+ *
+ * @param cause to be handled exception
+ */
+ public static void handleException(final Exception cause) {
+ if (null == cause) {
+ return;
+ }
+ if (isIgnoredException(cause) || null != cause.getCause() && isIgnoredException(cause.getCause())) {
+ log.debug("Ignored exception for: {}", cause.getMessage());
+ } else if (cause instanceof InterruptedException) {
+ Thread.currentThread().interrupt();
+ } else {
+ throw new RegistryCenterException(cause);
+ }
+ }
+
+ private static boolean isIgnoredException(final Throwable cause) {
+ return cause instanceof ConnectionLossException || cause instanceof NoNodeException || cause instanceof NodeExistsException;
+ }
+}
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/ZookeeperRegistryCenter.java b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-zookeeper-curator/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/curator/CuratorZookeeperRegistryCenter.java
similarity index 80%
rename from sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/ZookeeperRegistryCenter.java
rename to sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-zookeeper-curator/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/curator/CuratorZookeeperRegistryCenter.java
index 8f1c2590b69ec..f6e1edd2dee62 100644
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/ZookeeperRegistryCenter.java
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-zookeeper-curator/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/curator/CuratorZookeeperRegistryCenter.java
@@ -15,12 +15,12 @@
*
*/
-package io.shardingsphere.orchestration.reg.zookeeper;
+package io.shardingsphere.orchestration.reg.zookeeper.curator;
import com.google.common.base.Charsets;
import com.google.common.base.Strings;
import io.shardingsphere.orchestration.reg.api.RegistryCenter;
-import io.shardingsphere.orchestration.reg.exception.RegExceptionHandler;
+import io.shardingsphere.orchestration.reg.api.RegistryCenterConfiguration;
import io.shardingsphere.orchestration.reg.listener.DataChangedEvent;
import io.shardingsphere.orchestration.reg.listener.EventListener;
import org.apache.curator.framework.CuratorFramework;
@@ -47,34 +47,35 @@
import java.util.concurrent.TimeUnit;
/**
- * Zookeeper based registry center.
+ * Registry center for zookeeper with curator.
*
* @author zhangliang
*/
-public final class ZookeeperRegistryCenter implements RegistryCenter {
-
- private final CuratorFramework client;
+public final class CuratorZookeeperRegistryCenter implements RegistryCenter {
private final Map caches = new HashMap<>();
- public ZookeeperRegistryCenter(final ZookeeperConfiguration zkConfig) {
- client = buildCuratorClient(zkConfig);
- initCuratorClient(zkConfig);
+ private CuratorFramework client;
+
+ @Override
+ public void init(final RegistryCenterConfiguration config) {
+ client = buildCuratorClient(config);
+ initCuratorClient(config);
}
- private CuratorFramework buildCuratorClient(final ZookeeperConfiguration zkConfig) {
+ private CuratorFramework buildCuratorClient(final RegistryCenterConfiguration config) {
CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder()
- .connectString(zkConfig.getServerLists())
- .retryPolicy(new ExponentialBackoffRetry(zkConfig.getBaseSleepTimeMilliseconds(), zkConfig.getMaxRetries(), zkConfig.getMaxSleepTimeMilliseconds()))
- .namespace(zkConfig.getNamespace());
- if (0 != zkConfig.getSessionTimeoutMilliseconds()) {
- builder.sessionTimeoutMs(zkConfig.getSessionTimeoutMilliseconds());
+ .connectString(config.getServerLists())
+ .retryPolicy(new ExponentialBackoffRetry(config.getRetryIntervalMilliseconds(), config.getMaxRetries(), config.getRetryIntervalMilliseconds() * config.getMaxRetries()))
+ .namespace(config.getNamespace());
+ if (0 != config.getTimeToLiveSeconds()) {
+ builder.sessionTimeoutMs(config.getTimeToLiveSeconds() * 1000);
}
- if (0 != zkConfig.getConnectionTimeoutMilliseconds()) {
- builder.connectionTimeoutMs(zkConfig.getConnectionTimeoutMilliseconds());
+ if (0 != config.getOperationTimeoutMilliseconds()) {
+ builder.connectionTimeoutMs(config.getOperationTimeoutMilliseconds());
}
- if (!Strings.isNullOrEmpty(zkConfig.getDigest())) {
- builder.authorization("digest", zkConfig.getDigest().getBytes(Charsets.UTF_8))
+ if (!Strings.isNullOrEmpty(config.getDigest())) {
+ builder.authorization("digest", config.getDigest().getBytes(Charsets.UTF_8))
.aclProvider(new ACLProvider() {
@Override
@@ -91,15 +92,15 @@ public List getAclForPath(final String path) {
return builder.build();
}
- private void initCuratorClient(final ZookeeperConfiguration zkConfig) {
+ private void initCuratorClient(final RegistryCenterConfiguration config) {
client.start();
try {
- if (!client.blockUntilConnected(zkConfig.getMaxSleepTimeMilliseconds() * zkConfig.getMaxRetries(), TimeUnit.MILLISECONDS)) {
+ if (!client.blockUntilConnected(config.getRetryIntervalMilliseconds() * config.getMaxRetries(), TimeUnit.MILLISECONDS)) {
client.close();
throw new OperationTimeoutException();
}
} catch (final InterruptedException | OperationTimeoutException ex) {
- RegExceptionHandler.handleException(ex);
+ CuratorZookeeperExceptionHandler.handleException(ex);
}
}
@@ -132,7 +133,7 @@ public String getDirectly(final String key) {
// CHECKSTYLE:OFF
} catch (final Exception ex) {
// CHECKSTYLE:ON
- RegExceptionHandler.handleException(ex);
+ CuratorZookeeperExceptionHandler.handleException(ex);
return null;
}
}
@@ -144,7 +145,7 @@ public boolean isExisted(final String key) {
// CHECKSTYLE:OFF
} catch (final Exception ex) {
// CHECKSTYLE:ON
- RegExceptionHandler.handleException(ex);
+ CuratorZookeeperExceptionHandler.handleException(ex);
return false;
}
}
@@ -164,7 +165,7 @@ public int compare(final String o1, final String o2) {
// CHECKSTYLE:OFF
} catch (final Exception ex) {
// CHECKSTYLE:ON
- RegExceptionHandler.handleException(ex);
+ CuratorZookeeperExceptionHandler.handleException(ex);
return Collections.emptyList();
}
}
@@ -180,7 +181,7 @@ public void persist(final String key, final String value) {
// CHECKSTYLE:OFF
} catch (final Exception ex) {
// CHECKSTYLE:ON
- RegExceptionHandler.handleException(ex);
+ CuratorZookeeperExceptionHandler.handleException(ex);
}
}
@@ -191,7 +192,7 @@ public void update(final String key, final String value) {
// CHECKSTYLE:OFF
} catch (final Exception ex) {
// CHECKSTYLE:ON
- RegExceptionHandler.handleException(ex);
+ CuratorZookeeperExceptionHandler.handleException(ex);
}
}
@@ -205,7 +206,7 @@ public void persistEphemeral(final String key, final String value) {
// CHECKSTYLE:OFF
} catch (final Exception ex) {
// CHECKSTYLE:ON
- RegExceptionHandler.handleException(ex);
+ CuratorZookeeperExceptionHandler.handleException(ex);
}
}
@@ -247,7 +248,7 @@ private void addCacheData(final String cachePath) {
// CHECKSTYLE:OFF
} catch (final Exception ex) {
// CHECKSTYLE:ON
- RegExceptionHandler.handleException(ex);
+ CuratorZookeeperExceptionHandler.handleException(ex);
}
caches.put(cachePath + "/", cache);
}
diff --git a/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-zookeeper-curator/src/main/resources/META-INF/services/io.shardingsphere.orchestration.reg.api.RegistryCenter b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-zookeeper-curator/src/main/resources/META-INF/services/io.shardingsphere.orchestration.reg.api.RegistryCenter
new file mode 100644
index 0000000000000..a3141c0e381b4
--- /dev/null
+++ b/sharding-orchestration/sharding-orchestration-reg/sharding-orchestration-reg-zookeeper-curator/src/main/resources/META-INF/services/io.shardingsphere.orchestration.reg.api.RegistryCenter
@@ -0,0 +1 @@
+io.shardingsphere.orchestration.reg.zookeeper.curator.CuratorZookeeperRegistryCenter
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/api/RegistryCenterConfiguration.java b/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/api/RegistryCenterConfiguration.java
deleted file mode 100644
index d6e0f20f1ffe3..0000000000000
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/api/RegistryCenterConfiguration.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright 2016-2018 shardingsphere.io.
- *
- * Licensed 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 io.shardingsphere.orchestration.reg.api;
-
-/**
- * Registry center configuration.
- *
- * @author zhangliang
- */
-public interface RegistryCenterConfiguration {
-}
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/ZookeeperConfiguration.java b/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/ZookeeperConfiguration.java
deleted file mode 100644
index 7e312cd88754c..0000000000000
--- a/sharding-orchestration/sharding-orchestration-reg/src/main/java/io/shardingsphere/orchestration/reg/zookeeper/ZookeeperConfiguration.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright 2016-2018 shardingsphere.io.
- *
- * Licensed 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 io.shardingsphere.orchestration.reg.zookeeper;
-
-import io.shardingsphere.orchestration.reg.api.RegistryCenterConfiguration;
-import lombok.Getter;
-import lombok.Setter;
-
-/**
- * Zookeeper based registry center configuration.
- *
- * @author zhangliang
- */
-@Getter
-@Setter
-public final class ZookeeperConfiguration implements RegistryCenterConfiguration {
-
- /**
- * Zookeeper server list.
- *
- * Include ip address and port, multiple servers split by comma. Etc: {@code host1:2181,host2:2181}
- */
- private String serverLists;
-
- /**
- * Namespace of zookeeper.
- */
- private String namespace;
-
- /**
- * Base sleep time milliseconds.
- */
- private int baseSleepTimeMilliseconds = 1000;
-
- /**
- * Max sleep time milliseconds.
- */
- private int maxSleepTimeMilliseconds = 3000;
-
- /**
- * Max retries.
- */
- private int maxRetries = 3;
-
- /**
- * Session timeout milliseconds.
- */
- private int sessionTimeoutMilliseconds;
-
- /**
- * Connection timeout milliseconds.
- */
- private int connectionTimeoutMilliseconds;
-
- /**
- * Digest for zookeeper.
- *
- * Default is not need digest
- */
- private String digest;
-
- /**
- * RegCenter for zookeeper.
- *
- * Default is ZookeeperRegistryCenter
- */
- private boolean useNative;
-}
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/AllTests.java b/sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/AllTests.java
deleted file mode 100644
index 3caa14bd21de1..0000000000000
--- a/sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/AllTests.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2016-2018 shardingsphere.io.
- *
- * Licensed 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 io.shardingsphere.orchestration;
-
-import io.shardingsphere.orchestration.reg.AllRegTests;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.junit.runners.Suite.SuiteClasses;
-
-@RunWith(Suite.class)
-@SuiteClasses(AllRegTests.class)
-public final class AllTests {
-}
diff --git a/sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/AllRegTests.java b/sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/AllRegTests.java
deleted file mode 100644
index dbe89af06ee73..0000000000000
--- a/sharding-orchestration/sharding-orchestration-reg/src/test/java/io/shardingsphere/orchestration/reg/AllRegTests.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2016-2018 shardingsphere.io.
- *
- * Licensed 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 io.shardingsphere.orchestration.reg;
-
-import io.shardingsphere.orchestration.reg.newzk.AllNewzkTests;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.junit.runners.Suite.SuiteClasses;
-
-@RunWith(Suite.class)
-@SuiteClasses(AllNewzkTests.class)
-public final class AllRegTests {
-}
diff --git a/sharding-proxy/pom.xml b/sharding-proxy/pom.xml
index 2aa359ee26a5b..27339aa94c715 100644
--- a/sharding-proxy/pom.xml
+++ b/sharding-proxy/pom.xml
@@ -9,7 +9,6 @@
3.0.0.M5-SNAPSHOT
sharding-proxy
- ${project.artifactId}
@@ -27,6 +26,11 @@
sharding-orchestration-core
${project.version}
+
+ io.shardingsphere
+ sharding-orchestration-reg-zookeeper-curator
+ ${project.version}
+
io.shardingsphere
sharding-opentracing
diff --git a/sharding-proxy/src/main/java/io/shardingsphere/shardingproxy/backend/jdbc/execute/JDBCExecuteEngine.java b/sharding-proxy/src/main/java/io/shardingsphere/shardingproxy/backend/jdbc/execute/JDBCExecuteEngine.java
index d3708fc714999..66a1f6fdea2d6 100644
--- a/sharding-proxy/src/main/java/io/shardingsphere/shardingproxy/backend/jdbc/execute/JDBCExecuteEngine.java
+++ b/sharding-proxy/src/main/java/io/shardingsphere/shardingproxy/backend/jdbc/execute/JDBCExecuteEngine.java
@@ -183,7 +183,7 @@ public List getConnections(final ConnectionMode connectionMode, fina
@Override
public StatementExecuteUnit createStatementExecuteUnit(final Connection connection, final RouteUnit routeUnit, final ConnectionMode connectionMode) throws SQLException {
- Statement statement = getJdbcExecutorWrapper().createStatement(connection, routeUnit.getSqlUnit().getSql(), isReturnGeneratedKeys);
+ Statement statement = getJdbcExecutorWrapper().createStatement(connection, routeUnit.getSqlUnit(), isReturnGeneratedKeys);
if (connectionMode.equals(ConnectionMode.MEMORY_STRICTLY)) {
statement.setFetchSize(MEMORY_FETCH_ONE_ROW_A_TIME);
}
diff --git a/sharding-proxy/src/main/java/io/shardingsphere/shardingproxy/backend/jdbc/wrapper/JDBCExecutorWrapper.java b/sharding-proxy/src/main/java/io/shardingsphere/shardingproxy/backend/jdbc/wrapper/JDBCExecutorWrapper.java
index e3e38547a8d78..163730cf9b4a5 100644
--- a/sharding-proxy/src/main/java/io/shardingsphere/shardingproxy/backend/jdbc/wrapper/JDBCExecutorWrapper.java
+++ b/sharding-proxy/src/main/java/io/shardingsphere/shardingproxy/backend/jdbc/wrapper/JDBCExecutorWrapper.java
@@ -19,6 +19,7 @@
import io.shardingsphere.core.constant.DatabaseType;
import io.shardingsphere.core.routing.SQLRouteResult;
+import io.shardingsphere.core.routing.SQLUnit;
import java.sql.Connection;
import java.sql.SQLException;
@@ -44,12 +45,12 @@ public interface JDBCExecutorWrapper {
* Create statement.
*
* @param connection connection
- * @param sql SQL
+ * @param sqlUnit sql unit
* @param isReturnGeneratedKeys is return generated keys
* @return statement
* @throws SQLException SQL exception
*/
- Statement createStatement(Connection connection, String sql, boolean isReturnGeneratedKeys) throws SQLException;
+ Statement createStatement(Connection connection, SQLUnit sqlUnit, boolean isReturnGeneratedKeys) throws SQLException;
/**
* Execute SQL.
diff --git a/sharding-proxy/src/main/java/io/shardingsphere/shardingproxy/backend/jdbc/wrapper/PreparedStatementExecutorWrapper.java b/sharding-proxy/src/main/java/io/shardingsphere/shardingproxy/backend/jdbc/wrapper/PreparedStatementExecutorWrapper.java
index bbbd634b5fc40..3f093956eb6ee 100644
--- a/sharding-proxy/src/main/java/io/shardingsphere/shardingproxy/backend/jdbc/wrapper/PreparedStatementExecutorWrapper.java
+++ b/sharding-proxy/src/main/java/io/shardingsphere/shardingproxy/backend/jdbc/wrapper/PreparedStatementExecutorWrapper.java
@@ -35,6 +35,7 @@
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Collections;
+import java.util.LinkedList;
import java.util.List;
/**
@@ -72,8 +73,9 @@ private SQLRouteResult doShardingRoute(final String sql, final DatabaseType data
}
@Override
- public Statement createStatement(final Connection connection, final String sql, final boolean isReturnGeneratedKeys) throws SQLException {
- PreparedStatement result = isReturnGeneratedKeys ? connection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS) : connection.prepareStatement(sql);
+ public Statement createStatement(final Connection connection, final SQLUnit sqlUnit, final boolean isReturnGeneratedKeys) throws SQLException {
+ PreparedStatement result = isReturnGeneratedKeys ? connection.prepareStatement(sqlUnit.getSql(), Statement.RETURN_GENERATED_KEYS) : connection.prepareStatement(sqlUnit.getSql());
+ List parameters = getRoutedParameters(sqlUnit);
for (int i = 0; i < parameters.size(); i++) {
result.setObject(i + 1, parameters.get(i));
}
@@ -84,4 +86,12 @@ public Statement createStatement(final Connection connection, final String sql,
public boolean executeSQL(final Statement statement, final String sql, final boolean isReturnGeneratedKeys) throws SQLException {
return ((PreparedStatement) statement).execute();
}
+
+ private List getRoutedParameters(final SQLUnit sqlUnit) {
+ List result = new LinkedList<>();
+ for (List each : sqlUnit.getParameterSets()) {
+ result.addAll(each);
+ }
+ return result;
+ }
}
diff --git a/sharding-proxy/src/main/java/io/shardingsphere/shardingproxy/backend/jdbc/wrapper/StatementExecutorWrapper.java b/sharding-proxy/src/main/java/io/shardingsphere/shardingproxy/backend/jdbc/wrapper/StatementExecutorWrapper.java
index 1716417c0c53d..bedec3c89f85b 100644
--- a/sharding-proxy/src/main/java/io/shardingsphere/shardingproxy/backend/jdbc/wrapper/StatementExecutorWrapper.java
+++ b/sharding-proxy/src/main/java/io/shardingsphere/shardingproxy/backend/jdbc/wrapper/StatementExecutorWrapper.java
@@ -70,7 +70,7 @@ private SQLRouteResult doShardingRoute(final String sql, final DatabaseType data
}
@Override
- public Statement createStatement(final Connection connection, final String sql, final boolean isReturnGeneratedKeys) throws SQLException {
+ public Statement createStatement(final Connection connection, final SQLUnit sqlUnit, final boolean isReturnGeneratedKeys) throws SQLException {
return connection.createStatement();
}
diff --git a/sharding-proxy/src/main/resources/conf/config-sharding.yaml b/sharding-proxy/src/main/resources/conf/config-sharding.yaml
index 623f24a53d293..09cf66f7455df 100644
--- a/sharding-proxy/src/main/resources/conf/config-sharding.yaml
+++ b/sharding-proxy/src/main/resources/conf/config-sharding.yaml
@@ -45,6 +45,7 @@
# inline:
# shardingColumn: order_id
# algorithmExpression: t_order_item_${order_id % 2}
+# keyGeneratorColumnName: order_item_id
# bindingTables:
# - t_order,t_order_item
# defaultDatabaseStrategy:
diff --git a/sharding-proxy/src/main/resources/conf/server.yaml b/sharding-proxy/src/main/resources/conf/server.yaml
index a4cc257e916a9..adc2e1b20bdcd 100644
--- a/sharding-proxy/src/main/resources/conf/server.yaml
+++ b/sharding-proxy/src/main/resources/conf/server.yaml
@@ -7,9 +7,9 @@
#orchestration:
# name: orchestration_ds
# overwrite: true
-# zookeeper:
-# namespace: orchestration
+# registry:
# serverLists: localhost:2181
+# namespace: orchestration
#
#authentication:
# username: root
diff --git a/sharding-proxy/src/test/java/io/shardingsphere/shardingproxy/config/ShardingConfigurationLoaderTest.java b/sharding-proxy/src/test/java/io/shardingsphere/shardingproxy/config/ShardingConfigurationLoaderTest.java
index 80df8e35e1bce..ed02f5494dabd 100644
--- a/sharding-proxy/src/test/java/io/shardingsphere/shardingproxy/config/ShardingConfigurationLoaderTest.java
+++ b/sharding-proxy/src/test/java/io/shardingsphere/shardingproxy/config/ShardingConfigurationLoaderTest.java
@@ -46,9 +46,8 @@ public void assertLoad() throws IOException {
private void assertOrchestrationConfiguration(final YamlOrchestrationConfiguration actual) {
assertThat(actual.getName(), is("orchestration_ds"));
assertTrue(actual.isOverwrite());
- assertThat(actual.getZookeeper().getNamespace(), is("orchestration"));
- assertThat(actual.getZookeeper().getServerLists(), is("localhost:2181"));
- assertNull(actual.getEtcd());
+ assertThat(actual.getRegistry().getNamespace(), is("orchestration"));
+ assertThat(actual.getRegistry().getServerLists(), is("localhost:2181"));
}
private void assertShardingRuleConfiguration(final ProxyYamlRuleConfiguration actual) {
diff --git a/sharding-proxy/src/test/resources/conf/server.yaml b/sharding-proxy/src/test/resources/conf/server.yaml
index cdfa291185d7f..5c630f322113c 100644
--- a/sharding-proxy/src/test/resources/conf/server.yaml
+++ b/sharding-proxy/src/test/resources/conf/server.yaml
@@ -1,9 +1,9 @@
orchestration:
name: orchestration_ds
overwrite: true
- zookeeper:
- namespace: orchestration
+ registry:
serverLists: localhost:2181
+ namespace: orchestration
authentication:
username: root
diff --git a/sharding-sql-test/pom.xml b/sharding-sql-test/pom.xml
index b6bbfd57b05eb..817be9a49f764 100644
--- a/sharding-sql-test/pom.xml
+++ b/sharding-sql-test/pom.xml
@@ -4,10 +4,9 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
- sharding-sphere
io.shardingsphere
+ sharding-sphere
3.0.0.M5-SNAPSHOT
sharding-sql-test
- ${project.artifactId}
diff --git a/sharding-sql-test/src/main/resources/sql/dml/delete.xml b/sharding-sql-test/src/main/resources/sql/dml/delete.xml
index e666055cbe28f..b0e5d0fdf945f 100644
--- a/sharding-sql-test/src/main/resources/sql/dml/delete.xml
+++ b/sharding-sql-test/src/main/resources/sql/dml/delete.xml
@@ -2,7 +2,7 @@
-
+
diff --git a/sharding-sql-test/src/main/resources/sql/dml/insert.xml b/sharding-sql-test/src/main/resources/sql/dml/insert.xml
index af7be2f83fd8b..84df43f91730b 100644
--- a/sharding-sql-test/src/main/resources/sql/dml/insert.xml
+++ b/sharding-sql-test/src/main/resources/sql/dml/insert.xml
@@ -3,7 +3,7 @@
-
+
diff --git a/sharding-transaction/pom.xml b/sharding-transaction/pom.xml
index bfc47ce71dd07..3d276cfe82782 100644
--- a/sharding-transaction/pom.xml
+++ b/sharding-transaction/pom.xml
@@ -9,7 +9,6 @@
3.0.0.M5-SNAPSHOT
sharding-transaction
- ${project.artifactId}