You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by ch...@apache.org on 2024/03/14 14:13:32 UTC
(shardingsphere) branch master updated: Refactor YamlBroadcastDataNodeRuleConfigurationSwapper (#30488)
This is an automated email from the ASF dual-hosted git repository.
chengzhang 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 48465b54d8a Refactor YamlBroadcastDataNodeRuleConfigurationSwapper (#30488)
48465b54d8a is described below
commit 48465b54d8a0dce7f5537eef46a08e745c5d04be
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Thu Mar 14 22:13:25 2024 +0800
Refactor YamlBroadcastDataNodeRuleConfigurationSwapper (#30488)
---
.../swapper/YamlBroadcastDataNodeRuleConfigurationSwapper.java | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/yaml/swapper/YamlBroadcastDataNodeRuleConfigurationSwapper.java b/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/yaml/swapper/YamlBroadcastDataNodeRuleConfigurationSwapper.java
index b074d52b3e9..0c77405e52a 100644
--- a/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/yaml/swapper/YamlBroadcastDataNodeRuleConfigurationSwapper.java
+++ b/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/yaml/swapper/YamlBroadcastDataNodeRuleConfigurationSwapper.java
@@ -44,9 +44,13 @@ public final class YamlBroadcastDataNodeRuleConfigurationSwapper implements Yaml
if (data.getTables().isEmpty()) {
return Collections.emptyList();
}
- YamlBroadcastRuleConfiguration yamlBroadcastRuleConfig = new YamlBroadcastRuleConfiguration();
- yamlBroadcastRuleConfig.getTables().addAll(data.getTables());
- return Collections.singleton(new YamlDataNode(BroadcastRuleNodePathProvider.TABLES, YamlEngine.marshal(yamlBroadcastRuleConfig)));
+ return Collections.singleton(new YamlDataNode(BroadcastRuleNodePathProvider.TABLES, YamlEngine.marshal(swapToTablesYamlConfiguration(data))));
+ }
+
+ private YamlBroadcastRuleConfiguration swapToTablesYamlConfiguration(final BroadcastRuleConfiguration data) {
+ YamlBroadcastRuleConfiguration result = new YamlBroadcastRuleConfiguration();
+ result.getTables().addAll(data.getTables());
+ return result;
}
@Override