From fcbbe058749be0d0fbddda589f1948577ec29017 Mon Sep 17 00:00:00 2001 From: zhangliang Date: Sun, 5 Jan 2025 13:51:15 +0800 Subject: [PATCH] Rename GlobalNodePath --- .../node/DatabaseMetaDataNodePath.java | 6 +- .../metadata/persist/node/GlobalNode.java | 123 ------------------ .../metadata/persist/node/GlobalNodePath.java | 123 ++++++++++++++++++ .../global/GlobalRulePersistService.java | 16 +-- .../global/PropertiesPersistService.java | 14 +- .../persist/node/GlobalNodePathTest.java | 71 ++++++++++ .../metadata/persist/node/GlobalNodeTest.java | 56 -------- .../global/GlobalRuleChangedHandler.java | 9 +- .../global/PropertiesChangedHandler.java | 7 +- 9 files changed, 219 insertions(+), 206 deletions(-) delete mode 100644 kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/node/GlobalNode.java create mode 100644 kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/node/GlobalNodePath.java create mode 100644 kernel/metadata/core/src/test/java/org/apache/shardingsphere/metadata/persist/node/GlobalNodePathTest.java delete mode 100644 kernel/metadata/core/src/test/java/org/apache/shardingsphere/metadata/persist/node/GlobalNodeTest.java diff --git a/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/node/DatabaseMetaDataNodePath.java b/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/node/DatabaseMetaDataNodePath.java index 76f98613910bb..9f0b1c2ac015f 100644 --- a/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/node/DatabaseMetaDataNodePath.java +++ b/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/node/DatabaseMetaDataNodePath.java @@ -36,9 +36,9 @@ public final class DatabaseMetaDataNodePath { private static final String TABLES_NODE = "tables"; - private static final String ACTIVE_VERSION = "active_version"; + private static final String VERSIONS_NODE = "versions"; - private static final String VERSIONS = "versions"; + private static final String ACTIVE_VERSION_NODE = "active_version"; private static final String IDENTIFIER_PATTERN = "([\\w\\-]+)"; @@ -101,7 +101,7 @@ public static String getTablesPath(final String databaseName, final String schem * @return version path */ public static String getVersionPath(final String rulePath, final String activeVersion) { - return rulePath.replace(ACTIVE_VERSION, VERSIONS) + "/" + activeVersion; + return rulePath.replace(ACTIVE_VERSION_NODE, VERSIONS_NODE) + "/" + activeVersion; } /** diff --git a/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/node/GlobalNode.java b/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/node/GlobalNode.java deleted file mode 100644 index 5da5ab0b4e7c6..0000000000000 --- a/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/node/GlobalNode.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 org.apache.shardingsphere.metadata.persist.node; - -import lombok.AccessLevel; -import lombok.NoArgsConstructor; - -/** - * Global node. - */ -@NoArgsConstructor(access = AccessLevel.PRIVATE) -public final class GlobalNode { - - private static final String RULE_NODE = "rules"; - - private static final String PROPS_NODE = "props"; - - private static final String ACTIVE_VERSION = "active_version"; - - private static final String VERSIONS = "versions"; - - /** - * Get global rule node. - * - * @param rulePath rule path - * @return global rule node - */ - public static String getGlobalRuleNode(final String rulePath) { - return String.join("/", getGlobalRuleRootNode(), rulePath); - } - - /** - * Get global rule active version node. - * - * @param rulePath rule path - * @return global rule active version node - */ - public static String getGlobalRuleActiveVersionNode(final String rulePath) { - return String.join("/", getGlobalRuleRootNode(), rulePath, ACTIVE_VERSION); - } - - /** - * Get global rule versions node. - * - * @param ruleName rule name - * @return global rule versions node - */ - public static String getGlobalRuleVersionsNode(final String ruleName) { - return String.join("/", getGlobalRuleRootNode(), ruleName, VERSIONS); - } - - /** - * Get global rule version node. - * - * @param ruleName rule name - * @param version version - * @return global rule version node - */ - public static String getGlobalRuleVersionNode(final String ruleName, final String version) { - return String.join("/", getGlobalRuleVersionsNode(ruleName), version); - } - - /** - * Get global rule root node. - * - * @return global rule root node - */ - public static String getGlobalRuleRootNode() { - return String.join("/", "", RULE_NODE); - } - - /** - * Get properties active version node. - * - * @return properties active version node - */ - public static String getPropsActiveVersionNode() { - return String.join("/", getPropsRootNode(), ACTIVE_VERSION); - } - - /** - * Get properties version node. - * - * @param version version - * @return properties version node - */ - public static String getPropsVersionNode(final String version) { - return String.join("/", getPropsVersionsNode(), version); - } - - /** - * Get properties versions node. - * - * @return properties versions node - */ - public static String getPropsVersionsNode() { - return String.join("/", getPropsRootNode(), VERSIONS); - } - - /** - * Get properties node. - * - * @return properties node - */ - public static String getPropsRootNode() { - return String.join("/", "", PROPS_NODE); - } -} diff --git a/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/node/GlobalNodePath.java b/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/node/GlobalNodePath.java new file mode 100644 index 0000000000000..f67fe564f210f --- /dev/null +++ b/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/node/GlobalNodePath.java @@ -0,0 +1,123 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.shardingsphere.metadata.persist.node; + +import lombok.AccessLevel; +import lombok.NoArgsConstructor; + +/** + * Global node path. + */ +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public final class GlobalNodePath { + + private static final String RULE_NODE = "rules"; + + private static final String PROPS_NODE = "props"; + + private static final String VERSIONS_NODE = "versions"; + + private static final String ACTIVE_VERSION_NODE = "active_version"; + + /** + * Get global rule root path. + * + * @return global rule root path + */ + public static String getRuleRootPath() { + return String.join("/", "", RULE_NODE); + } + + /** + * Get global rule path. + * + * @param ruleName rule name + * @return global rule path + */ + public static String getRulePath(final String ruleName) { + return String.join("/", getRuleRootPath(), ruleName); + } + + /** + * Get global rule versions path. + * + * @param ruleName rule name + * @return global rule versions path + */ + public static String getRuleVersionsPath(final String ruleName) { + return String.join("/", getRulePath(ruleName), VERSIONS_NODE); + } + + /** + * Get global rule version path. + * + * @param ruleName rule name + * @param version version + * @return global rule version path + */ + public static String getRuleVersionPath(final String ruleName, final String version) { + return String.join("/", getRuleVersionsPath(ruleName), version); + } + + /** + * Get global rule active version path. + * + * @param ruleName rule name + * @return global rule active version path + */ + public static String getRuleActiveVersionPath(final String ruleName) { + return String.join("/", getRulePath(ruleName), ACTIVE_VERSION_NODE); + } + + /** + * Get properties path. + * + * @return properties path + */ + public static String getPropsRootPath() { + return String.join("/", "", PROPS_NODE); + } + + /** + * Get properties versions path. + * + * @return properties versions path + */ + public static String getPropsVersionsPath() { + return String.join("/", getPropsRootPath(), VERSIONS_NODE); + } + + /** + * Get properties version path. + * + * @param version version + * @return properties version path + */ + public static String getPropsVersionPath(final String version) { + return String.join("/", getPropsVersionsPath(), version); + } + + /** + * Get properties active version path. + * + * @return properties active version path + */ + public static String getPropsActiveVersionPath() { + return String.join("/", getPropsRootPath(), ACTIVE_VERSION_NODE); + } +} diff --git a/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/service/config/global/GlobalRulePersistService.java b/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/service/config/global/GlobalRulePersistService.java index a9935d6426014..63ce71ba0456c 100644 --- a/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/service/config/global/GlobalRulePersistService.java +++ b/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/service/config/global/GlobalRulePersistService.java @@ -22,7 +22,7 @@ import org.apache.shardingsphere.infra.metadata.version.MetaDataVersion; import org.apache.shardingsphere.infra.yaml.config.pojo.rule.YamlRuleConfiguration; import org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlRuleConfigurationSwapperEngine; -import org.apache.shardingsphere.metadata.persist.node.GlobalNode; +import org.apache.shardingsphere.metadata.persist.node.GlobalNodePath; import org.apache.shardingsphere.metadata.persist.service.config.RepositoryTuplePersistService; import org.apache.shardingsphere.metadata.persist.service.version.MetaDataVersionPersistService; import org.apache.shardingsphere.mode.spi.PersistRepository; @@ -57,7 +57,7 @@ public GlobalRulePersistService(final PersistRepository repository, final MetaDa * @return global rule configurations */ public Collection load() { - return new RepositoryTupleSwapperEngine().swapToRuleConfigurations(repositoryTuplePersistService.load(GlobalNode.getGlobalRuleRootNode())); + return new RepositoryTupleSwapperEngine().swapToRuleConfigurations(repositoryTuplePersistService.load(GlobalNodePath.getRuleRootPath())); } /** @@ -67,7 +67,7 @@ public Collection load() { * @return global rule configuration */ public Optional load(final String ruleTypeName) { - return new RepositoryTupleSwapperEngine().swapToRuleConfiguration(ruleTypeName, repositoryTuplePersistService.load(GlobalNode.getGlobalRuleNode(ruleTypeName))); + return new RepositoryTupleSwapperEngine().swapToRuleConfiguration(ruleTypeName, repositoryTuplePersistService.load(GlobalNodePath.getRulePath(ruleTypeName))); } /** @@ -87,13 +87,13 @@ public void persist(final Collection globalRuleConfigs) { private Collection persistTuples(final Collection repositoryTuples) { Collection result = new LinkedList<>(); for (RepositoryTuple each : repositoryTuples) { - List versions = metaDataVersionPersistService.getVersions(GlobalNode.getGlobalRuleVersionsNode(each.getKey())); + List versions = metaDataVersionPersistService.getVersions(GlobalNodePath.getRuleVersionsPath(each.getKey())); String nextActiveVersion = versions.isEmpty() ? MetaDataVersion.DEFAULT_VERSION : String.valueOf(Integer.parseInt(versions.get(0)) + 1); - repository.persist(GlobalNode.getGlobalRuleVersionNode(each.getKey(), nextActiveVersion), each.getValue()); - if (Strings.isNullOrEmpty(repository.query(GlobalNode.getGlobalRuleActiveVersionNode(each.getKey())))) { - repository.persist(GlobalNode.getGlobalRuleActiveVersionNode(each.getKey()), MetaDataVersion.DEFAULT_VERSION); + repository.persist(GlobalNodePath.getRuleVersionPath(each.getKey(), nextActiveVersion), each.getValue()); + if (Strings.isNullOrEmpty(repository.query(GlobalNodePath.getRuleActiveVersionPath(each.getKey())))) { + repository.persist(GlobalNodePath.getRuleActiveVersionPath(each.getKey()), MetaDataVersion.DEFAULT_VERSION); } - result.add(new MetaDataVersion(GlobalNode.getGlobalRuleNode(each.getKey()), repository.query(GlobalNode.getGlobalRuleActiveVersionNode(each.getKey())), nextActiveVersion)); + result.add(new MetaDataVersion(GlobalNodePath.getRulePath(each.getKey()), repository.query(GlobalNodePath.getRuleActiveVersionPath(each.getKey())), nextActiveVersion)); } return result; } diff --git a/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/service/config/global/PropertiesPersistService.java b/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/service/config/global/PropertiesPersistService.java index c7e35fbbeab1b..0d682b5fbfa9c 100644 --- a/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/service/config/global/PropertiesPersistService.java +++ b/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/service/config/global/PropertiesPersistService.java @@ -21,7 +21,7 @@ import lombok.RequiredArgsConstructor; import org.apache.shardingsphere.infra.metadata.version.MetaDataVersion; import org.apache.shardingsphere.infra.util.yaml.YamlEngine; -import org.apache.shardingsphere.metadata.persist.node.GlobalNode; +import org.apache.shardingsphere.metadata.persist.node.GlobalNodePath; import org.apache.shardingsphere.metadata.persist.service.version.MetaDataVersionPersistService; import org.apache.shardingsphere.mode.spi.PersistRepository; @@ -45,7 +45,7 @@ public final class PropertiesPersistService { * @return properties */ public Properties load() { - String yamlContent = repository.query(GlobalNode.getPropsVersionNode(getActiveVersion())); + String yamlContent = repository.query(GlobalNodePath.getPropsVersionPath(getActiveVersion())); return Strings.isNullOrEmpty(yamlContent) ? new Properties() : YamlEngine.unmarshal(yamlContent, Properties.class); } @@ -55,16 +55,16 @@ public Properties load() { * @param props properties */ public void persist(final Properties props) { - List versions = metaDataVersionPersistService.getVersions(GlobalNode.getPropsVersionsNode()); + List versions = metaDataVersionPersistService.getVersions(GlobalNodePath.getPropsVersionsPath()); String nextActiveVersion = versions.isEmpty() ? MetaDataVersion.DEFAULT_VERSION : String.valueOf(Integer.parseInt(versions.get(0)) + 1); - repository.persist(GlobalNode.getPropsVersionNode(nextActiveVersion), YamlEngine.marshal(props)); + repository.persist(GlobalNodePath.getPropsVersionPath(nextActiveVersion), YamlEngine.marshal(props)); if (Strings.isNullOrEmpty(getActiveVersion())) { - repository.persist(GlobalNode.getPropsActiveVersionNode(), MetaDataVersion.DEFAULT_VERSION); + repository.persist(GlobalNodePath.getPropsActiveVersionPath(), MetaDataVersion.DEFAULT_VERSION); } - metaDataVersionPersistService.switchActiveVersion(Collections.singleton(new MetaDataVersion(GlobalNode.getPropsRootNode(), getActiveVersion(), nextActiveVersion))); + metaDataVersionPersistService.switchActiveVersion(Collections.singleton(new MetaDataVersion(GlobalNodePath.getPropsRootPath(), getActiveVersion(), nextActiveVersion))); } private String getActiveVersion() { - return repository.query(GlobalNode.getPropsActiveVersionNode()); + return repository.query(GlobalNodePath.getPropsActiveVersionPath()); } } diff --git a/kernel/metadata/core/src/test/java/org/apache/shardingsphere/metadata/persist/node/GlobalNodePathTest.java b/kernel/metadata/core/src/test/java/org/apache/shardingsphere/metadata/persist/node/GlobalNodePathTest.java new file mode 100644 index 0000000000000..0f4d7fd842490 --- /dev/null +++ b/kernel/metadata/core/src/test/java/org/apache/shardingsphere/metadata/persist/node/GlobalNodePathTest.java @@ -0,0 +1,71 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.shardingsphere.metadata.persist.node; + +import org.junit.jupiter.api.Test; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; + +class GlobalNodePathTest { + + @Test + void assertGetRuleRootPath() { + assertThat(GlobalNodePath.getRuleRootPath(), is("/rules")); + } + + @Test + void assertGetRulePath() { + assertThat(GlobalNodePath.getRulePath("foo_rule"), is("/rules/foo_rule")); + } + + @Test + void assertGetRuleVersionsPath() { + assertThat(GlobalNodePath.getRuleVersionsPath("foo_rule"), is("/rules/foo_rule/versions")); + } + + @Test + void assertGetRuleVersionPath() { + assertThat(GlobalNodePath.getRuleVersionPath("foo_rule", "0"), is("/rules/foo_rule/versions/0")); + } + + @Test + void assertGetRuleActiveVersionPath() { + assertThat(GlobalNodePath.getRuleActiveVersionPath("foo_rule"), is("/rules/foo_rule/active_version")); + } + + @Test + void assertGetPropsRootPath() { + assertThat(GlobalNodePath.getPropsRootPath(), is("/props")); + } + + @Test + void assertGetPropsVersionsPath() { + assertThat(GlobalNodePath.getPropsVersionsPath(), is("/props/versions")); + } + + @Test + void assertGetPropsVersionPath() { + assertThat(GlobalNodePath.getPropsVersionPath("0"), is("/props/versions/0")); + } + + @Test + void assertGetPropsActiveVersionPath() { + assertThat(GlobalNodePath.getPropsActiveVersionPath(), is("/props/active_version")); + } +} diff --git a/kernel/metadata/core/src/test/java/org/apache/shardingsphere/metadata/persist/node/GlobalNodeTest.java b/kernel/metadata/core/src/test/java/org/apache/shardingsphere/metadata/persist/node/GlobalNodeTest.java deleted file mode 100644 index 8f08a6037fef8..0000000000000 --- a/kernel/metadata/core/src/test/java/org/apache/shardingsphere/metadata/persist/node/GlobalNodeTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 org.apache.shardingsphere.metadata.persist.node; - -import org.junit.jupiter.api.Test; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; - -class GlobalNodeTest { - - @Test - void assertGetGlobalRuleRootNode() { - assertThat(GlobalNode.getGlobalRuleRootNode(), is("/rules")); - } - - @Test - void assertGetPropsActiveVersionNode() { - assertThat(GlobalNode.getPropsActiveVersionNode(), is("/props/active_version")); - } - - @Test - void assertGetPropsVersionNode() { - assertThat(GlobalNode.getPropsVersionNode("0"), is("/props/versions/0")); - } - - @Test - void assertGetGlobalRuleActiveVersionNode() { - assertThat(GlobalNode.getGlobalRuleActiveVersionNode("transaction"), is("/rules/transaction/active_version")); - } - - @Test - void assertGetGlobalRuleVersionsNode() { - assertThat(GlobalNode.getGlobalRuleVersionsNode("transaction"), is("/rules/transaction/versions")); - } - - @Test - void assertGetGlobalRuleVersionNode() { - assertThat(GlobalNode.getGlobalRuleVersionNode("transaction", "0"), is("/rules/transaction/versions/0")); - } -} diff --git a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/GlobalRuleChangedHandler.java b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/GlobalRuleChangedHandler.java index 7ab73fb1474d5..6fc360afa1a33 100644 --- a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/GlobalRuleChangedHandler.java +++ b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/GlobalRuleChangedHandler.java @@ -20,12 +20,11 @@ import com.google.common.base.Preconditions; import org.apache.shardingsphere.infra.config.rule.RuleConfiguration; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; -import org.apache.shardingsphere.metadata.persist.node.GlobalNode; +import org.apache.shardingsphere.metadata.persist.node.GlobalNodePath; import org.apache.shardingsphere.mode.event.DataChangedEvent; import org.apache.shardingsphere.mode.event.DataChangedEvent.Type; import org.apache.shardingsphere.mode.manager.ContextManager; import org.apache.shardingsphere.mode.manager.cluster.dispatch.handler.DataChangedEventHandler; -import org.apache.shardingsphere.mode.path.GlobalNodePath; import org.apache.shardingsphere.mode.spi.RuleConfigurationPersistDecorator; import java.util.Arrays; @@ -39,7 +38,7 @@ public final class GlobalRuleChangedHandler implements DataChangedEventHandler { @Override public String getSubscribedKey() { - return GlobalNode.getGlobalRuleRootNode(); + return GlobalNodePath.getRuleRootPath(); } @Override @@ -50,10 +49,10 @@ public Collection getSubscribedTypes() { @SuppressWarnings("unchecked") @Override public void handle(final ContextManager contextManager, final DataChangedEvent event) { - if (!GlobalNodePath.isRuleActiveVersionPath(event.getKey())) { + if (!org.apache.shardingsphere.mode.path.GlobalNodePath.isRuleActiveVersionPath(event.getKey())) { return; } - Optional ruleName = GlobalNodePath.getRuleName(event.getKey()); + Optional ruleName = org.apache.shardingsphere.mode.path.GlobalNodePath.getRuleName(event.getKey()); if (!ruleName.isPresent()) { return; } diff --git a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/PropertiesChangedHandler.java b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/PropertiesChangedHandler.java index bd010471dd901..e43a324620956 100644 --- a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/PropertiesChangedHandler.java +++ b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/PropertiesChangedHandler.java @@ -18,12 +18,11 @@ package org.apache.shardingsphere.mode.manager.cluster.dispatch.handler.global; import com.google.common.base.Preconditions; -import org.apache.shardingsphere.metadata.persist.node.GlobalNode; +import org.apache.shardingsphere.metadata.persist.node.GlobalNodePath; import org.apache.shardingsphere.mode.event.DataChangedEvent; import org.apache.shardingsphere.mode.event.DataChangedEvent.Type; import org.apache.shardingsphere.mode.manager.ContextManager; import org.apache.shardingsphere.mode.manager.cluster.dispatch.handler.DataChangedEventHandler; -import org.apache.shardingsphere.mode.path.GlobalNodePath; import java.util.Arrays; import java.util.Collection; @@ -35,7 +34,7 @@ public final class PropertiesChangedHandler implements DataChangedEventHandler { @Override public String getSubscribedKey() { - return GlobalNode.getPropsRootNode(); + return GlobalNodePath.getPropsRootPath(); } @Override @@ -45,7 +44,7 @@ public Collection getSubscribedTypes() { @Override public void handle(final ContextManager contextManager, final DataChangedEvent event) { - if (!GlobalNodePath.isPropsActiveVersionPath(event.getKey())) { + if (!org.apache.shardingsphere.mode.path.GlobalNodePath.isPropsActiveVersionPath(event.getKey())) { return; } Preconditions.checkArgument(event.getValue().equals(