Skip to content

Commit

Permalink
Rname YamlShardingSphereDataSourceFactory.RULE_CONFIG_SWAPPER (#30136)
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu authored Feb 15, 2024
1 parent b623113 commit 43438e5
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class YamlShardingSphereDataSourceFactory {

private static final YamlRuleConfigurationSwapperEngine SWAPPER_ENGINE = new YamlRuleConfigurationSwapperEngine();
private static final YamlRuleConfigurationSwapperEngine RULE_CONFIG_SWAPPER = new YamlRuleConfigurationSwapperEngine();

private static final YamlDataSourceConfigurationSwapper DATA_SOURCE_SWAPPER = new YamlDataSourceConfigurationSwapper();

Expand All @@ -72,7 +72,7 @@ public static DataSource createDataSourceWithoutCache(final YamlRootConfiguratio

private static DataSource createDataSource(final Map<String, DataSource> dataSourceMap, final YamlRootConfiguration rootConfig) throws SQLException {
ModeConfiguration modeConfig = null == rootConfig.getMode() ? null : new YamlModeConfigurationSwapper().swapToObject(rootConfig.getMode());
Collection<RuleConfiguration> ruleConfigs = SWAPPER_ENGINE.swapToRuleConfigurations(rootConfig.getRules());
Collection<RuleConfiguration> ruleConfigs = RULE_CONFIG_SWAPPER.swapToRuleConfigurations(rootConfig.getRules());
return ShardingSphereDataSourceFactory.createDataSource(rootConfig.getDatabaseName(), modeConfig, dataSourceMap, ruleConfigs, rootConfig.getProps());
}

Expand Down Expand Up @@ -163,7 +163,7 @@ private static DataSource createDataSource(final DataSource dataSource, final Ya
private static DataSource createDataSource(final Map<String, DataSource> dataSourceMap, final YamlJDBCConfiguration jdbcConfig) throws SQLException {
rebuildGlobalRuleConfiguration(jdbcConfig);
ModeConfiguration modeConfig = null == jdbcConfig.getMode() ? null : new YamlModeConfigurationSwapper().swapToObject(jdbcConfig.getMode());
Collection<RuleConfiguration> ruleConfigs = SWAPPER_ENGINE.swapToRuleConfigurations(jdbcConfig.getRules());
Collection<RuleConfiguration> ruleConfigs = RULE_CONFIG_SWAPPER.swapToRuleConfigurations(jdbcConfig.getRules());
return ShardingSphereDataSourceFactory.createDataSource(jdbcConfig.getDatabaseName(), modeConfig, dataSourceMap, ruleConfigs, jdbcConfig.getProps());
}

Expand Down

0 comments on commit 43438e5

Please sign in to comment.