Skip to content

Commit

Permalink
Optimize RuleMetaData
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangML committed Nov 1, 2023
1 parent 9c8a0e7 commit a2c2bed
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,17 +134,17 @@ private Collection<String> getInUsedStorageUnitNames(final DataNodeContainedRule
return rule.getAllDataNodes().values().stream().flatMap(each -> each.stream().map(DataNode::getDataSourceName).collect(Collectors.toSet()).stream()).collect(Collectors.toSet());
}

private void mergeInUsedStorageUnitNameAndRules(final Map<String, Collection<Class<? extends ShardingSphereRule>>> storageUnitNameAndRulesMap,
final Map<String, Collection<Class<? extends ShardingSphereRule>>> toBeMergeStorageUnitNameAndRulesMap) {
for (Entry<String, Collection<Class<? extends ShardingSphereRule>>> entry : toBeMergeStorageUnitNameAndRulesMap.entrySet()) {
if (storageUnitNameAndRulesMap.containsKey(entry.getKey())) {
private void mergeInUsedStorageUnitNameAndRules(final Map<String, Collection<Class<? extends ShardingSphereRule>>> storageUnitNameAndRules,
final Map<String, Collection<Class<? extends ShardingSphereRule>>> toBeMergedStorageUnitNameAndRules) {
for (Entry<String, Collection<Class<? extends ShardingSphereRule>>> entry : toBeMergedStorageUnitNameAndRules.entrySet()) {
if (storageUnitNameAndRules.containsKey(entry.getKey())) {
for (Class<? extends ShardingSphereRule> each : entry.getValue()) {
if (!storageUnitNameAndRulesMap.get(entry.getKey()).contains(each)) {
storageUnitNameAndRulesMap.get(entry.getKey()).add(each);
if (!storageUnitNameAndRules.get(entry.getKey()).contains(each)) {
storageUnitNameAndRules.get(entry.getKey()).add(each);
}
}
} else {
storageUnitNameAndRulesMap.put(entry.getKey(), entry.getValue());
storageUnitNameAndRules.put(entry.getKey(), entry.getValue());
}
}
}
Expand Down

0 comments on commit a2c2bed

Please sign in to comment.