This is an automated email from the ASF dual-hosted git repository. zhangliang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push: new b5f777b26c9 Merge VersionNodePathParser and VersionNodePath (#34917) b5f777b26c9 is described below commit b5f777b26c91458dd53194625585c159854ea0db Author: Liang Zhang <zhangli...@apache.org> AuthorDate: Fri Mar 7 16:15:43 2025 +0800 Merge VersionNodePathParser and VersionNodePath (#34917) --- .../changed/RuleItemChangedNodePathBuilder.java | 6 +-- .../mode/node/path/version/VersionNodePath.java | 16 ++++++++ .../node/path/version/VersionNodePathParser.java | 45 ---------------------- .../config/GlobalPropertiesNodePathTest.java | 5 +-- .../type/global/config/GlobalRuleNodePathTest.java | 5 +-- .../path/version/VersionNodePathParserTest.java | 42 -------------------- .../node/path/version/VersionNodePathTest.java | 17 ++++++++ .../datasource/StorageNodeChangedHandler.java | 4 +- .../datasource/StorageUnitChangedHandler.java | 4 +- .../database/metadata/TableChangedHandler.java | 4 +- .../database/metadata/ViewChangedHandler.java | 4 +- .../rule/RuleConfigurationChangedHandler.java | 4 +- .../global/config/GlobalRuleChangedHandler.java | 4 +- .../global/config/PropertiesChangedHandler.java | 4 +- 14 files changed, 54 insertions(+), 110 deletions(-) diff --git a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/changed/RuleItemChangedNodePathBuilder.java b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/changed/RuleItemChangedNodePathBuilder.java index 9b410e58665..18f7f631f43 100644 --- a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/changed/RuleItemChangedNodePathBuilder.java +++ b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/changed/RuleItemChangedNodePathBuilder.java @@ -20,7 +20,7 @@ package org.apache.shardingsphere.mode.metadata.changed; import org.apache.shardingsphere.mode.node.path.engine.searcher.NodePathSearcher; import org.apache.shardingsphere.mode.node.path.type.database.metadata.rule.DatabaseRuleItem; import org.apache.shardingsphere.mode.node.path.type.database.metadata.rule.DatabaseRuleNodePath; -import org.apache.shardingsphere.mode.node.path.version.VersionNodePathParser; +import org.apache.shardingsphere.mode.node.path.version.VersionNodePath; import org.apache.shardingsphere.mode.node.rule.node.DatabaseRuleNode; import org.apache.shardingsphere.mode.node.rule.node.DatabaseRuleNodeGenerator; @@ -50,13 +50,13 @@ public final class RuleItemChangedNodePathBuilder { continue; } DatabaseRuleNodePath databaseRuleNodePath = new DatabaseRuleNodePath(databaseName, databaseRuleNode.getRuleType(), new DatabaseRuleItem(each, itemName.get())); - if (new VersionNodePathParser(databaseRuleNodePath).isActiveVersionPath(path)) { + if (new VersionNodePath(databaseRuleNodePath).isActiveVersionPath(path)) { return Optional.of(databaseRuleNodePath); } } for (String each : databaseRuleNode.getUniqueItems()) { DatabaseRuleNodePath databaseRuleNodePath = new DatabaseRuleNodePath(databaseName, databaseRuleNode.getRuleType(), new DatabaseRuleItem(each)); - if (new VersionNodePathParser(databaseRuleNodePath).isActiveVersionPath(path)) { + if (new VersionNodePath(databaseRuleNodePath).isActiveVersionPath(path)) { return Optional.of(databaseRuleNodePath); } } diff --git a/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/version/VersionNodePath.java b/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/version/VersionNodePath.java index 0efb50c413d..c36cc58556c 100644 --- a/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/version/VersionNodePath.java +++ b/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/version/VersionNodePath.java @@ -20,6 +20,8 @@ package org.apache.shardingsphere.mode.node.path.version; import org.apache.shardingsphere.mode.node.path.NodePath; import org.apache.shardingsphere.mode.node.path.engine.generator.NodePathGenerator; +import java.util.regex.Pattern; + /** * Version node path. */ @@ -62,4 +64,18 @@ public final class VersionNodePath { public String getVersionPath(final int version) { return String.join("/", getVersionsPath(), String.valueOf(version)); } + + /** + * Judge whether to active version path. + * + * @param path to be judged path + * @return is active version path or not + */ + public boolean isActiveVersionPath(final String path) { + return createActiveVersionPathPattern().matcher(path).find(); + } + + private Pattern createActiveVersionPathPattern() { + return Pattern.compile(getActiveVersionPath() + "$", Pattern.CASE_INSENSITIVE); + } } diff --git a/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/version/VersionNodePathParser.java b/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/version/VersionNodePathParser.java deleted file mode 100644 index dc9904f8771..00000000000 --- a/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/version/VersionNodePathParser.java +++ /dev/null @@ -1,45 +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.mode.node.path.version; - -import org.apache.shardingsphere.mode.node.path.NodePath; - -import java.util.regex.Pattern; - -/** - * Version node path parser. - */ -public final class VersionNodePathParser { - - private final Pattern activeVersionPattern; - - public VersionNodePathParser(final NodePath nodePath) { - VersionNodePath versionNodePath = new VersionNodePath(nodePath); - activeVersionPattern = Pattern.compile(versionNodePath.getActiveVersionPath() + "$", Pattern.CASE_INSENSITIVE); - } - - /** - * Judge whether to active version path. - * - * @param path to be judged path - * @return is active version path or not - */ - public boolean isActiveVersionPath(final String path) { - return activeVersionPattern.matcher(path).find(); - } -} diff --git a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/config/GlobalPropertiesNodePathTest.java b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/config/GlobalPropertiesNodePathTest.java index aa3d22de899..e35eabbfd97 100644 --- a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/config/GlobalPropertiesNodePathTest.java +++ b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/config/GlobalPropertiesNodePathTest.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.mode.node.path.type.global.config; import org.apache.shardingsphere.mode.node.path.engine.generator.NodePathGenerator; -import org.apache.shardingsphere.mode.node.path.version.VersionNodePathParser; +import org.apache.shardingsphere.mode.node.path.version.VersionNodePath; import org.junit.jupiter.api.Test; import static org.hamcrest.CoreMatchers.is; @@ -34,7 +34,6 @@ class GlobalPropertiesNodePathTest { @Test void assertGetVersion() { - VersionNodePathParser versionNodePathParser = new VersionNodePathParser(new GlobalPropertiesNodePath()); - assertTrue(versionNodePathParser.isActiveVersionPath("/props/active_version")); + assertTrue(new VersionNodePath(new GlobalPropertiesNodePath()).isActiveVersionPath("/props/active_version")); } } diff --git a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/config/GlobalRuleNodePathTest.java b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/config/GlobalRuleNodePathTest.java index b0cd7048347..7009dff8dfe 100644 --- a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/config/GlobalRuleNodePathTest.java +++ b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/config/GlobalRuleNodePathTest.java @@ -19,7 +19,7 @@ package org.apache.shardingsphere.mode.node.path.type.global.config; import org.apache.shardingsphere.mode.node.path.engine.generator.NodePathGenerator; import org.apache.shardingsphere.mode.node.path.engine.searcher.NodePathSearcher; -import org.apache.shardingsphere.mode.node.path.version.VersionNodePathParser; +import org.apache.shardingsphere.mode.node.path.version.VersionNodePath; import org.junit.jupiter.api.Test; import static org.hamcrest.CoreMatchers.is; @@ -37,8 +37,7 @@ class GlobalRuleNodePathTest { @Test void assertGetVersion() { - VersionNodePathParser versionNodePathParser = new VersionNodePathParser(new GlobalRuleNodePath("foo_rule")); - assertTrue(versionNodePathParser.isActiveVersionPath("/rules/foo_rule/active_version")); + assertTrue(new VersionNodePath(new GlobalRuleNodePath("foo_rule")).isActiveVersionPath("/rules/foo_rule/active_version")); } @Test diff --git a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/version/VersionNodePathParserTest.java b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/version/VersionNodePathParserTest.java deleted file mode 100644 index 93633fb32eb..00000000000 --- a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/version/VersionNodePathParserTest.java +++ /dev/null @@ -1,42 +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.mode.node.path.version; - -import org.apache.shardingsphere.mode.node.path.engine.searcher.NodePathPattern; -import org.apache.shardingsphere.mode.node.path.type.database.metadata.schema.TableMetadataNodePath; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; - -class VersionNodePathParserTest { - - private final VersionNodePathParser parser = new VersionNodePathParser(new TableMetadataNodePath("foo_db", "foo_schema", NodePathPattern.IDENTIFIER)); - - @Test - void assertIsActiveVersionPath() { - assertTrue(parser.isActiveVersionPath("/metadata/foo_db/schemas/foo_schema/tables/foo_tbl/active_version")); - } - - @Test - void assertIsNotActiveVersionPath() { - assertFalse(parser.isActiveVersionPath("/metadata/foo_db/schemas/foo_schema/tables/foo_tbl/versions/0")); - assertFalse(parser.isActiveVersionPath("/metadata/foo_db/schemas/foo_schema/tables/foo_tbl")); - assertFalse(parser.isActiveVersionPath("/metadata/bar_db/schemas/foo_schema/tables/foo_tbl/active_version")); - } -} diff --git a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/version/VersionNodePathTest.java b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/version/VersionNodePathTest.java index 1f9559f00b9..535f72d715d 100644 --- a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/version/VersionNodePathTest.java +++ b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/version/VersionNodePathTest.java @@ -17,11 +17,14 @@ package org.apache.shardingsphere.mode.node.path.version; +import org.apache.shardingsphere.mode.node.path.engine.searcher.NodePathPattern; import org.apache.shardingsphere.mode.node.path.type.database.metadata.schema.TableMetadataNodePath; import org.junit.jupiter.api.Test; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; class VersionNodePathTest { @@ -39,4 +42,18 @@ class VersionNodePathTest { void assertGetVersionPath() { assertThat(new VersionNodePath(new TableMetadataNodePath("foo_db", "foo_schema", "foo_tbl")).getVersionPath(0), is("/metadata/foo_db/schemas/foo_schema/tables/foo_tbl/versions/0")); } + + @Test + void assertIsActiveVersionPath() { + VersionNodePath versionNodePath = new VersionNodePath(new TableMetadataNodePath("foo_db", "foo_schema", NodePathPattern.IDENTIFIER)); + assertTrue(versionNodePath.isActiveVersionPath("/metadata/foo_db/schemas/foo_schema/tables/foo_tbl/active_version")); + } + + @Test + void assertIsNotActiveVersionPath() { + VersionNodePath versionNodePath = new VersionNodePath(new TableMetadataNodePath("foo_db", "foo_schema", NodePathPattern.IDENTIFIER)); + assertFalse(versionNodePath.isActiveVersionPath("/metadata/foo_db/schemas/foo_schema/tables/foo_tbl/versions/0")); + assertFalse(versionNodePath.isActiveVersionPath("/metadata/foo_db/schemas/foo_schema/tables/foo_tbl")); + assertFalse(versionNodePath.isActiveVersionPath("/metadata/bar_db/schemas/foo_schema/tables/foo_tbl/active_version")); + } } diff --git a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/database/datasource/StorageNodeChangedHandler.java b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/database/datasource/StorageNodeChangedHandler.java index 0125ed253b1..35f035cf1f8 100644 --- a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/database/datasource/StorageNodeChangedHandler.java +++ b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/database/datasource/StorageNodeChangedHandler.java @@ -24,7 +24,7 @@ import org.apache.shardingsphere.mode.manager.cluster.dispatch.handler.database. import org.apache.shardingsphere.mode.node.path.engine.searcher.NodePathPattern; import org.apache.shardingsphere.mode.node.path.engine.searcher.NodePathSearcher; import org.apache.shardingsphere.mode.node.path.type.database.metadata.datasource.StorageNodeNodePath; -import org.apache.shardingsphere.mode.node.path.version.VersionNodePathParser; +import org.apache.shardingsphere.mode.node.path.version.VersionNodePath; /** * Storage node changed handler. @@ -36,7 +36,7 @@ public final class StorageNodeChangedHandler implements DatabaseChangedHandler { @Override public boolean isSubscribed(final String databaseName, final String path) { - return new VersionNodePathParser(new StorageNodeNodePath(databaseName, NodePathPattern.IDENTIFIER)).isActiveVersionPath(path); + return new VersionNodePath(new StorageNodeNodePath(databaseName, NodePathPattern.IDENTIFIER)).isActiveVersionPath(path); } @Override diff --git a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/database/datasource/StorageUnitChangedHandler.java b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/database/datasource/StorageUnitChangedHandler.java index d50a9508c24..722227bd631 100644 --- a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/database/datasource/StorageUnitChangedHandler.java +++ b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/database/datasource/StorageUnitChangedHandler.java @@ -26,7 +26,7 @@ import org.apache.shardingsphere.mode.metadata.manager.ActiveVersionChecker; import org.apache.shardingsphere.mode.node.path.engine.searcher.NodePathPattern; import org.apache.shardingsphere.mode.node.path.engine.searcher.NodePathSearcher; import org.apache.shardingsphere.mode.node.path.type.database.metadata.datasource.StorageUnitNodePath; -import org.apache.shardingsphere.mode.node.path.version.VersionNodePathParser; +import org.apache.shardingsphere.mode.node.path.version.VersionNodePath; import java.util.Collections; @@ -46,7 +46,7 @@ public final class StorageUnitChangedHandler implements DatabaseChangedHandler { @Override public boolean isSubscribed(final String databaseName, final String path) { - return new VersionNodePathParser(new StorageUnitNodePath(databaseName, NodePathPattern.IDENTIFIER)).isActiveVersionPath(path); + return new VersionNodePath(new StorageUnitNodePath(databaseName, NodePathPattern.IDENTIFIER)).isActiveVersionPath(path); } @Override diff --git a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/database/metadata/TableChangedHandler.java b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/database/metadata/TableChangedHandler.java index bdd3952b8f6..18b81efba41 100644 --- a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/database/metadata/TableChangedHandler.java +++ b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/database/metadata/TableChangedHandler.java @@ -26,7 +26,7 @@ import org.apache.shardingsphere.mode.metadata.refresher.statistics.StatisticsRe import org.apache.shardingsphere.mode.node.path.engine.searcher.NodePathPattern; import org.apache.shardingsphere.mode.node.path.engine.searcher.NodePathSearcher; import org.apache.shardingsphere.mode.node.path.type.database.metadata.schema.TableMetadataNodePath; -import org.apache.shardingsphere.mode.node.path.version.VersionNodePathParser; +import org.apache.shardingsphere.mode.node.path.version.VersionNodePath; /** * Table changed handler. @@ -47,7 +47,7 @@ public final class TableChangedHandler implements DatabaseChangedHandler { @Override public boolean isSubscribed(final String databaseName, final String path) { - return new VersionNodePathParser(new TableMetadataNodePath(databaseName, NodePathPattern.IDENTIFIER, NodePathPattern.IDENTIFIER)).isActiveVersionPath(path); + return new VersionNodePath(new TableMetadataNodePath(databaseName, NodePathPattern.IDENTIFIER, NodePathPattern.IDENTIFIER)).isActiveVersionPath(path); } @Override diff --git a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/database/metadata/ViewChangedHandler.java b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/database/metadata/ViewChangedHandler.java index 64eacae2c92..d4b6d06699e 100644 --- a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/database/metadata/ViewChangedHandler.java +++ b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/database/metadata/ViewChangedHandler.java @@ -27,7 +27,7 @@ import org.apache.shardingsphere.mode.node.path.engine.searcher.NodePathPattern; import org.apache.shardingsphere.mode.node.path.engine.searcher.NodePathSearcher; import org.apache.shardingsphere.mode.node.path.type.database.metadata.schema.TableMetadataNodePath; import org.apache.shardingsphere.mode.node.path.type.database.metadata.schema.ViewMetadataNodePath; -import org.apache.shardingsphere.mode.node.path.version.VersionNodePathParser; +import org.apache.shardingsphere.mode.node.path.version.VersionNodePath; /** * View changed handler. @@ -48,7 +48,7 @@ public final class ViewChangedHandler implements DatabaseChangedHandler { @Override public boolean isSubscribed(final String databaseName, final String path) { - return new VersionNodePathParser(new ViewMetadataNodePath(databaseName, NodePathPattern.IDENTIFIER, NodePathPattern.IDENTIFIER)).isActiveVersionPath(path); + return new VersionNodePath(new ViewMetadataNodePath(databaseName, NodePathPattern.IDENTIFIER, NodePathPattern.IDENTIFIER)).isActiveVersionPath(path); } @Override diff --git a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/database/rule/RuleConfigurationChangedHandler.java b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/database/rule/RuleConfigurationChangedHandler.java index afadc79a3e4..c7c7d300ebb 100644 --- a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/database/rule/RuleConfigurationChangedHandler.java +++ b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/database/rule/RuleConfigurationChangedHandler.java @@ -25,7 +25,7 @@ import org.apache.shardingsphere.mode.metadata.changed.RuleItemChangedNodePathBu import org.apache.shardingsphere.mode.node.path.engine.searcher.NodePathPattern; import org.apache.shardingsphere.mode.node.path.type.database.metadata.rule.DatabaseRuleItem; import org.apache.shardingsphere.mode.node.path.type.database.metadata.rule.DatabaseRuleNodePath; -import org.apache.shardingsphere.mode.node.path.version.VersionNodePathParser; +import org.apache.shardingsphere.mode.node.path.version.VersionNodePath; import java.sql.SQLException; import java.util.Arrays; @@ -47,7 +47,7 @@ public final class RuleConfigurationChangedHandler implements DatabaseChangedHan Collection<DatabaseRuleNodePath> databaseRuleNodePaths = Arrays.asList( new DatabaseRuleNodePath(databaseName, NodePathPattern.QUALIFIED_IDENTIFIER, new DatabaseRuleItem(NodePathPattern.IDENTIFIER)), new DatabaseRuleNodePath(databaseName, NodePathPattern.IDENTIFIER, new DatabaseRuleItem(NodePathPattern.IDENTIFIER, NodePathPattern.QUALIFIED_IDENTIFIER))); - return databaseRuleNodePaths.stream().anyMatch(each -> new VersionNodePathParser(each).isActiveVersionPath(path)); + return databaseRuleNodePaths.stream().anyMatch(each -> new VersionNodePath(each).isActiveVersionPath(path)); } @Override diff --git a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/config/GlobalRuleChangedHandler.java b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/config/GlobalRuleChangedHandler.java index 59d3d1b0d60..345dbacc366 100644 --- a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/config/GlobalRuleChangedHandler.java +++ b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/config/GlobalRuleChangedHandler.java @@ -27,7 +27,7 @@ import org.apache.shardingsphere.mode.node.path.engine.generator.NodePathGenerat import org.apache.shardingsphere.mode.node.path.engine.searcher.NodePathPattern; import org.apache.shardingsphere.mode.node.path.engine.searcher.NodePathSearcher; import org.apache.shardingsphere.mode.node.path.type.global.config.GlobalRuleNodePath; -import org.apache.shardingsphere.mode.node.path.version.VersionNodePathParser; +import org.apache.shardingsphere.mode.node.path.version.VersionNodePath; import java.util.Arrays; import java.util.Collection; @@ -49,7 +49,7 @@ public final class GlobalRuleChangedHandler implements GlobalDataChangedEventHan @Override public void handle(final ContextManager contextManager, final DataChangedEvent event) { - if (!new VersionNodePathParser(new GlobalRuleNodePath(NodePathPattern.IDENTIFIER)).isActiveVersionPath(event.getKey())) { + if (!new VersionNodePath(new GlobalRuleNodePath(NodePathPattern.IDENTIFIER)).isActiveVersionPath(event.getKey())) { return; } if (!new ActiveVersionChecker(contextManager.getPersistServiceFacade().getRepository()).checkSame(event)) { diff --git a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/config/PropertiesChangedHandler.java b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/config/PropertiesChangedHandler.java index c80fbe765c8..b2df3d52d6e 100644 --- a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/config/PropertiesChangedHandler.java +++ b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/config/PropertiesChangedHandler.java @@ -24,7 +24,7 @@ import org.apache.shardingsphere.mode.manager.cluster.dispatch.handler.global.Gl import org.apache.shardingsphere.mode.metadata.manager.ActiveVersionChecker; import org.apache.shardingsphere.mode.node.path.engine.generator.NodePathGenerator; import org.apache.shardingsphere.mode.node.path.type.global.config.GlobalPropertiesNodePath; -import org.apache.shardingsphere.mode.node.path.version.VersionNodePathParser; +import org.apache.shardingsphere.mode.node.path.version.VersionNodePath; import java.util.Arrays; import java.util.Collection; @@ -46,7 +46,7 @@ public final class PropertiesChangedHandler implements GlobalDataChangedEventHan @Override public void handle(final ContextManager contextManager, final DataChangedEvent event) { - if (!new VersionNodePathParser(new GlobalPropertiesNodePath()).isActiveVersionPath(event.getKey())) { + if (!new VersionNodePath(new GlobalPropertiesNodePath()).isActiveVersionPath(event.getKey())) { return; } if (!new ActiveVersionChecker(contextManager.getPersistServiceFacade().getRepository()).checkSame(event)) {