This is an automated email from the ASF dual-hosted git repository.
panjuan 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 b56eee5918f Remove useless Collectors.toMap's mergeFunction (#28049)
b56eee5918f is described below
commit b56eee5918f47629650d78f89c06d280a3d13570
Author: Liang Zhang <[email protected]>
AuthorDate: Sat Aug 12 14:16:29 2023 +0800
Remove useless Collectors.toMap's mergeFunction (#28049)
---
.../swapper/YamlPluginsConfigurationSwapper.java | 2 +-
.../like/CharDigestLikeEncryptAlgorithm.java | 2 +-
.../query/ShowDefaultShadowAlgorithmExecutor.java | 2 +-
.../pool/creator/DataSourcePoolCreator.java | 2 +-
.../pool/props/DataSourcePoolProperties.java | 12 +--
.../props/DataSourcePoolPropertiesCreator.java | 110 ++++++++++-----------
.../props/DataSourcePoolPropertiesCreatorTest.java | 2 +-
.../metadata/node/PipelineMetaDataNodeWatcher.java | 2 +-
.../migration/api/impl/MigrationJobAPI.java | 2 +-
.../job/YamlMigrationJobConfigurationSwapper.java | 4 +-
.../metadata/persist/MetaDataPersistService.java | 6 +-
.../persist/NewMetaDataPersistService.java | 6 +-
.../type/database/DatabaseTimestampService.java | 2 +-
.../mode/metadata/MetaDataContextsFactory.java | 3 +-
.../mode/metadata/NewMetaDataContextsFactory.java | 3 +-
.../ConvertYamlConfigurationExecutor.java | 2 +-
.../rql/storage/unit/ShowStorageUnitExecutor.java | 2 +-
.../SelectInformationSchemataExecutorTest.java | 2 +-
18 files changed, 78 insertions(+), 88 deletions(-)
diff --git
a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/config/yaml/swapper/YamlPluginsConfigurationSwapper.java
b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/config/yaml/swapper/YamlPluginsConfigurationSwapper.java
index 4f3b535e827..d78fbc5499d 100644
---
a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/config/yaml/swapper/YamlPluginsConfigurationSwapper.java
+++
b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/config/yaml/swapper/YamlPluginsConfigurationSwapper.java
@@ -57,7 +57,7 @@ public final class YamlPluginsConfigurationSwapper {
private static Map<String, PluginConfiguration> swap(final Map<String,
YamlPluginConfiguration> yamlConfigs) {
return null == yamlConfigs
? Collections.emptyMap()
- :
yamlConfigs.entrySet().stream().collect(Collectors.toMap(Entry::getKey, entry
-> swap(entry.getValue()), (key, value) -> value, LinkedHashMap::new));
+ :
yamlConfigs.entrySet().stream().collect(Collectors.toMap(Entry::getKey, entry
-> swap(entry.getValue()), (oldValue, currentValue) -> oldValue,
LinkedHashMap::new));
}
private static PluginConfiguration swap(final YamlPluginConfiguration
yamlConfig) {
diff --git
a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/like/CharDigestLikeEncryptAlgorithm.java
b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/like/CharDigestLikeEncryptAlgorithm.java
index 8e0d45b62e4..b880212b50d 100644
---
a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/like/CharDigestLikeEncryptAlgorithm.java
+++
b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/like/CharDigestLikeEncryptAlgorithm.java
@@ -104,7 +104,7 @@ public final class CharDigestLikeEncryptAlgorithm
implements LikeEncryptAlgorith
private Map<Character, Integer> createCharIndexes(final Properties props) {
String dictContent = props.containsKey(DICT_KEY) &&
!Strings.isNullOrEmpty(props.getProperty(DICT_KEY)) ?
props.getProperty(DICT_KEY) : initDefaultDict();
- return IntStream.range(0,
dictContent.length()).boxed().collect(Collectors.toMap(dictContent::charAt,
index -> index, (a, b) -> b));
+ return IntStream.range(0,
dictContent.length()).boxed().collect(Collectors.toMap(dictContent::charAt,
index -> index, (oldValue, currentValue) -> oldValue));
}
@SneakyThrows(IOException.class)
diff --git
a/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShowDefaultShadowAlgorithmExecutor.java
b/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShowDefaultShadowAlgorithmExecutor.java
index db80eef366c..7201e5a48f2 100644
---
a/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShowDefaultShadowAlgorithmExecutor.java
+++
b/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShowDefaultShadowAlgorithmExecutor.java
@@ -50,7 +50,7 @@ public final class ShowDefaultShadowAlgorithmExecutor
implements RQLExecutor<Sho
ShadowRuleConfiguration config = (ShadowRuleConfiguration)
rule.get().getConfiguration();
String defaultAlgorithm = config.getDefaultShadowAlgorithmName();
Iterator<Entry<String, AlgorithmConfiguration>> data =
config.getShadowAlgorithms().entrySet().stream().filter(each ->
each.getKey().equals(defaultAlgorithm))
- .collect(Collectors.toMap(Entry::getKey, Entry::getValue,
(oldValue, currentValue) -> currentValue)).entrySet().iterator();
+ .collect(Collectors.toMap(Entry::getKey,
Entry::getValue)).entrySet().iterator();
Collection<LocalDataQueryResultRow> result = new LinkedList<>();
while (data.hasNext()) {
Entry<String, AlgorithmConfiguration> entry = data.next();
diff --git
a/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/creator/DataSourcePoolCreator.java
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/creator/DataSourcePoolCreator.java
index b9871266a08..64f56b9b4d6 100644
---
a/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/creator/DataSourcePoolCreator.java
+++
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/creator/DataSourcePoolCreator.java
@@ -206,7 +206,7 @@ public final class DataSourcePoolCreator {
if (poolMetaData.isPresent()) {
setDefaultFields(dataSourceReflection, poolMetaData.get());
setConfiguredFields(props, dataSourceReflection,
poolMetaData.get());
- appendJdbcUrlProperties(props.getCustomDataSourcePoolProperties(),
result, poolMetaData.get(), dataSourceReflection);
+ appendJdbcUrlProperties(props.getCustomProperties(), result,
poolMetaData.get(), dataSourceReflection);
dataSourceReflection.addDefaultDataSourcePoolProperties(poolMetaData.get());
} else {
setConfiguredFields(props, dataSourceReflection);
diff --git
a/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/props/DataSourcePoolProperties.java
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/props/DataSourcePoolProperties.java
index 65d372bcb78..fe249810441 100644
---
a/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/props/DataSourcePoolProperties.java
+++
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/props/DataSourcePoolProperties.java
@@ -45,7 +45,7 @@ public final class DataSourcePoolProperties {
private final PoolPropertySynonyms poolPropertySynonyms;
- private final CustomDataSourcePoolProperties
customDataSourcePoolProperties;
+ private final CustomDataSourcePoolProperties customProperties;
public DataSourcePoolProperties(final String poolClassName, final
Map<String, Object> props) {
Optional<DataSourcePoolMetaData> metaData =
TypedSPILoader.findService(DataSourcePoolMetaData.class, poolClassName);
@@ -54,7 +54,7 @@ public final class DataSourcePoolProperties {
connectionPropertySynonyms = new ConnectionPropertySynonyms(props,
propertySynonyms);
poolPropertySynonyms = new PoolPropertySynonyms(props,
propertySynonyms);
Collection<String> transientFieldNames =
metaData.map(DataSourcePoolMetaData::getTransientFieldNames).orElse(Collections.emptyList());
- customDataSourcePoolProperties = new
CustomDataSourcePoolProperties(props, getStandardPropertyKeys(),
transientFieldNames, propertySynonyms);
+ customProperties = new CustomDataSourcePoolProperties(props,
getStandardPropertyKeys(), transientFieldNames, propertySynonyms);
}
private Collection<String> getStandardPropertyKeys() {
@@ -70,10 +70,10 @@ public final class DataSourcePoolProperties {
*/
public Map<String, Object> getAllStandardProperties() {
Map<String, Object> result = new LinkedHashMap<>(
- connectionPropertySynonyms.getStandardProperties().size() +
poolPropertySynonyms.getStandardProperties().size() +
customDataSourcePoolProperties.getProperties().size(), 1F);
+ connectionPropertySynonyms.getStandardProperties().size() +
poolPropertySynonyms.getStandardProperties().size() +
customProperties.getProperties().size(), 1F);
result.putAll(connectionPropertySynonyms.getStandardProperties());
result.putAll(poolPropertySynonyms.getStandardProperties());
- result.putAll(customDataSourcePoolProperties.getProperties());
+ result.putAll(customProperties.getProperties());
return result;
}
@@ -84,10 +84,10 @@ public final class DataSourcePoolProperties {
*/
public Map<String, Object> getAllLocalProperties() {
Map<String, Object> result = new LinkedHashMap<>(
- connectionPropertySynonyms.getLocalProperties().size() +
poolPropertySynonyms.getLocalProperties().size() +
customDataSourcePoolProperties.getProperties().size(), 1F);
+ connectionPropertySynonyms.getLocalProperties().size() +
poolPropertySynonyms.getLocalProperties().size() +
customProperties.getProperties().size(), 1F);
result.putAll(connectionPropertySynonyms.getLocalProperties());
result.putAll(poolPropertySynonyms.getLocalProperties());
- result.putAll(customDataSourcePoolProperties.getProperties());
+ result.putAll(customProperties.getProperties());
return result;
}
diff --git
a/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/props/DataSourcePoolPropertiesCreator.java
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/props/DataSourcePoolPropertiesCreator.java
index a3a3af4f073..a1130c4df38 100644
---
a/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/props/DataSourcePoolPropertiesCreator.java
+++
b/infra/datasource/core/src/main/java/org/apache/shardingsphere/infra/datasource/pool/props/DataSourcePoolPropertiesCreator.java
@@ -47,22 +47,21 @@ public final class DataSourcePoolPropertiesCreator {
/**
* Create data source pool properties.
*
- * @param dataSourceConfigs data source configurations
+ * @param configs data source configurations
* @return created data source pool properties
*/
- public static Map<String, DataSourcePoolProperties>
createFromConfiguration(final Map<String, DataSourceConfiguration>
dataSourceConfigs) {
- return dataSourceConfigs.entrySet().stream().collect(Collectors
- .toMap(Entry::getKey, entry -> create(entry.getValue()),
(oldValue, currentValue) -> oldValue, LinkedHashMap::new));
+ public static Map<String, DataSourcePoolProperties>
createFromConfiguration(final Map<String, DataSourceConfiguration> configs) {
+ return
configs.entrySet().stream().collect(Collectors.toMap(Entry::getKey, entry ->
create(entry.getValue()), (oldValue, currentValue) -> oldValue,
LinkedHashMap::new));
}
/**
* Create data source properties.
*
- * @param dataSourceConfig data source configuration
+ * @param config data source configuration
* @return created data source properties
*/
- public static DataSourcePoolProperties create(final
DataSourceConfiguration dataSourceConfig) {
- return new
DataSourcePoolProperties(dataSourceConfig.getConnection().getDataSourceClassName(),
createProperties(dataSourceConfig));
+ public static DataSourcePoolProperties create(final
DataSourceConfiguration config) {
+ return new
DataSourcePoolProperties(config.getConnection().getDataSourceClassName(),
createProperties(config));
}
/**
@@ -72,11 +71,7 @@ public final class DataSourcePoolPropertiesCreator {
* @return created data source properties
*/
public static Map<String, DataSourcePoolProperties> create(final
Map<String, DataSource> dataSources) {
- Map<String, DataSourcePoolProperties> result = new LinkedHashMap<>();
- for (Entry<String, DataSource> entry : dataSources.entrySet()) {
- result.put(entry.getKey(), create(entry.getValue()));
- }
- return result;
+ return
dataSources.entrySet().stream().collect(Collectors.toMap(Entry::getKey, entry
-> create(entry.getValue()), (oldValue, currentValue) -> oldValue,
LinkedHashMap::new));
}
/**
@@ -86,46 +81,44 @@ public final class DataSourcePoolPropertiesCreator {
* @return created data source properties
*/
public static DataSourcePoolProperties create(final DataSource dataSource)
{
- return dataSource instanceof CatalogSwitchableDataSource
- ? new DataSourcePoolProperties(((CatalogSwitchableDataSource)
dataSource).getDataSource().getClass().getName(),
- createProperties(((CatalogSwitchableDataSource)
dataSource).getDataSource()))
- : new
DataSourcePoolProperties(dataSource.getClass().getName(),
createProperties(dataSource));
+ DataSource realDataSource = dataSource instanceof
CatalogSwitchableDataSource ? ((CatalogSwitchableDataSource)
dataSource).getDataSource() : dataSource;
+ return new
DataSourcePoolProperties(realDataSource.getClass().getName(),
createProperties(realDataSource));
}
@SuppressWarnings({"unchecked", "rawtypes"})
- private static Map<String, Object> createProperties(final
DataSourceConfiguration dataSourceConfig) {
+ private static Map<String, Object> createProperties(final
DataSourceConfiguration config) {
Map<String, Object> result = new LinkedHashMap<>();
- result.put("dataSourceClassName",
dataSourceConfig.getConnection().getDataSourceClassName());
- result.put("url", dataSourceConfig.getConnection().getUrl());
- result.put("username", dataSourceConfig.getConnection().getUsername());
- result.put("password", dataSourceConfig.getConnection().getPassword());
- result.put("connectionTimeoutMilliseconds",
dataSourceConfig.getPool().getConnectionTimeoutMilliseconds());
- result.put("idleTimeoutMilliseconds",
dataSourceConfig.getPool().getIdleTimeoutMilliseconds());
- result.put("maxLifetimeMilliseconds",
dataSourceConfig.getPool().getMaxLifetimeMilliseconds());
- result.put("maxPoolSize", dataSourceConfig.getPool().getMaxPoolSize());
- result.put("minPoolSize", dataSourceConfig.getPool().getMinPoolSize());
- result.put("readOnly", dataSourceConfig.getPool().getReadOnly());
- if (null != dataSourceConfig.getPool().getCustomProperties()) {
- result.putAll((Map)
dataSourceConfig.getPool().getCustomProperties());
+ result.put("dataSourceClassName",
config.getConnection().getDataSourceClassName());
+ result.put("url", config.getConnection().getUrl());
+ result.put("username", config.getConnection().getUsername());
+ result.put("password", config.getConnection().getPassword());
+ result.put("connectionTimeoutMilliseconds",
config.getPool().getConnectionTimeoutMilliseconds());
+ result.put("idleTimeoutMilliseconds",
config.getPool().getIdleTimeoutMilliseconds());
+ result.put("maxLifetimeMilliseconds",
config.getPool().getMaxLifetimeMilliseconds());
+ result.put("maxPoolSize", config.getPool().getMaxPoolSize());
+ result.put("minPoolSize", config.getPool().getMinPoolSize());
+ result.put("readOnly", config.getPool().getReadOnly());
+ if (null != config.getPool().getCustomProperties()) {
+ result.putAll((Map) config.getPool().getCustomProperties());
}
return result;
}
private static Map<String, Object> createProperties(final DataSource
dataSource) {
Map<String, Object> result = new LinkedHashMap<>();
- Optional<DataSourcePoolMetaData> poolMetaData =
TypedSPILoader.findService(DataSourcePoolMetaData.class,
dataSource.getClass().getName());
+ Optional<DataSourcePoolMetaData> metaData =
TypedSPILoader.findService(DataSourcePoolMetaData.class,
dataSource.getClass().getName());
for (Entry<String, Object> entry : new
DataSourceReflection(dataSource).convertToProperties().entrySet()) {
String propertyName = entry.getKey();
Object propertyValue = entry.getValue();
- if (!poolMetaData.isPresent() || isValidProperty(propertyName,
propertyValue, poolMetaData.get()) &&
!poolMetaData.get().getTransientFieldNames().contains(propertyName)) {
+ if (!metaData.isPresent() || isValidProperty(propertyName,
propertyValue, metaData.get()) &&
!metaData.get().getTransientFieldNames().contains(propertyName)) {
result.put(propertyName, propertyValue);
}
}
return result;
}
- private static boolean isValidProperty(final String key, final Object
value, final DataSourcePoolMetaData poolMetaData) {
- return !poolMetaData.getSkippedProperties().containsKey(key) || null
== value || !value.equals(poolMetaData.getSkippedProperties().get(key));
+ private static boolean isValidProperty(final String key, final Object
value, final DataSourcePoolMetaData metaData) {
+ return null == value ||
!metaData.getSkippedProperties().containsKey(key) ||
!value.equals(metaData.getSkippedProperties().get(key));
}
/**
@@ -135,57 +128,56 @@ public final class DataSourcePoolPropertiesCreator {
* @return created data source configuration
*/
public static DataSourceConfiguration createConfiguration(final
DataSourcePoolProperties props) {
- return new
DataSourceConfiguration(getConnectionConfiguration(props.getConnectionPropertySynonyms()),
- getPoolConfiguration(props.getPoolPropertySynonyms(),
props.getCustomDataSourcePoolProperties()));
+ return new
DataSourceConfiguration(getConnectionConfiguration(props.getConnectionPropertySynonyms()),
getPoolConfiguration(props.getPoolPropertySynonyms(),
props.getCustomProperties()));
}
- private static ConnectionConfiguration getConnectionConfiguration(final
ConnectionPropertySynonyms connectionPropertySynonyms) {
- Map<String, Object> standardProperties =
connectionPropertySynonyms.getStandardProperties();
- return new ConnectionConfiguration((String)
standardProperties.get("dataSourceClassName"), (String)
standardProperties.get("url"),
- (String) standardProperties.get("username"), (String)
standardProperties.get("password"));
+ private static ConnectionConfiguration getConnectionConfiguration(final
ConnectionPropertySynonyms connectionPropSynonyms) {
+ Map<String, Object> standardProps =
connectionPropSynonyms.getStandardProperties();
+ return new ConnectionConfiguration(
+ (String) standardProps.get("dataSourceClassName"), (String)
standardProps.get("url"), (String) standardProps.get("username"), (String)
standardProps.get("password"));
}
- private static PoolConfiguration getPoolConfiguration(final
PoolPropertySynonyms poolPropertySynonyms, final CustomDataSourcePoolProperties
customDataSourcePoolProperties) {
- Map<String, Object> standardProperties =
poolPropertySynonyms.getStandardProperties();
- Long connectionTimeoutMilliseconds = toLong(standardProperties,
"connectionTimeoutMilliseconds", null);
- Long idleTimeoutMilliseconds = toLong(standardProperties,
"idleTimeoutMilliseconds", null);
- Long maxLifetimeMilliseconds = toLong(standardProperties,
"maxLifetimeMilliseconds", null);
- Integer maxPoolSize = toInt(standardProperties, "maxPoolSize", null);
- Integer minPoolSize = toInt(standardProperties, "minPoolSize", null);
- Boolean readOnly = toBoolean(standardProperties, "readOnly", null);
- Properties customProperties = new Properties();
-
customProperties.putAll(customDataSourcePoolProperties.getProperties());
- return new PoolConfiguration(connectionTimeoutMilliseconds,
idleTimeoutMilliseconds, maxLifetimeMilliseconds, maxPoolSize, minPoolSize,
readOnly, customProperties);
+ private static PoolConfiguration getPoolConfiguration(final
PoolPropertySynonyms poolPropSynonyms, final CustomDataSourcePoolProperties
customProps) {
+ Map<String, Object> standardProps =
poolPropSynonyms.getStandardProperties();
+ Long connectionTimeoutMilliseconds = toLong(standardProps,
"connectionTimeoutMilliseconds", null);
+ Long idleTimeoutMilliseconds = toLong(standardProps,
"idleTimeoutMilliseconds", null);
+ Long maxLifetimeMilliseconds = toLong(standardProps,
"maxLifetimeMilliseconds", null);
+ Integer maxPoolSize = toInt(standardProps, "maxPoolSize", null);
+ Integer minPoolSize = toInt(standardProps, "minPoolSize", null);
+ Boolean readOnly = toBoolean(standardProps, "readOnly", null);
+ Properties newCustomProps = new Properties();
+ newCustomProps.putAll(customProps.getProperties());
+ return new PoolConfiguration(connectionTimeoutMilliseconds,
idleTimeoutMilliseconds, maxLifetimeMilliseconds, maxPoolSize, minPoolSize,
readOnly, newCustomProps);
}
- private static Long toLong(final Map<String, Object> properties, final
String name, final Long defaultValue) {
- if (!properties.containsKey(name)) {
+ private static Long toLong(final Map<String, Object> props, final String
name, final Long defaultValue) {
+ if (!props.containsKey(name)) {
return defaultValue;
}
try {
- return Long.parseLong(String.valueOf(properties.get(name)));
+ return Long.parseLong(String.valueOf(props.get(name)));
} catch (final NumberFormatException ex) {
return defaultValue;
}
}
- private static Integer toInt(final Map<String, Object> properties, final
String name, final Integer defaultValue) {
- if (!properties.containsKey(name)) {
+ private static Integer toInt(final Map<String, Object> props, final String
name, final Integer defaultValue) {
+ if (!props.containsKey(name)) {
return defaultValue;
}
try {
- return Integer.parseInt(String.valueOf(properties.get(name)));
+ return Integer.parseInt(String.valueOf(props.get(name)));
} catch (final NumberFormatException ex) {
return defaultValue;
}
}
- private static Boolean toBoolean(final Map<String, Object> properties,
final String name, final Boolean defaultValue) {
- if (!properties.containsKey(name)) {
+ private static Boolean toBoolean(final Map<String, Object> props, final
String name, final Boolean defaultValue) {
+ if (!props.containsKey(name)) {
return defaultValue;
}
try {
- return Boolean.parseBoolean(String.valueOf(properties.get(name)));
+ return Boolean.parseBoolean(String.valueOf(props.get(name)));
} catch (final NumberFormatException ex) {
return defaultValue;
}
diff --git
a/infra/datasource/core/src/test/java/org/apache/shardingsphere/infra/datasource/pool/props/DataSourcePoolPropertiesCreatorTest.java
b/infra/datasource/core/src/test/java/org/apache/shardingsphere/infra/datasource/pool/props/DataSourcePoolPropertiesCreatorTest.java
index 06a84b37839..14b5ce5ef07 100644
---
a/infra/datasource/core/src/test/java/org/apache/shardingsphere/infra/datasource/pool/props/DataSourcePoolPropertiesCreatorTest.java
+++
b/infra/datasource/core/src/test/java/org/apache/shardingsphere/infra/datasource/pool/props/DataSourcePoolPropertiesCreatorTest.java
@@ -80,7 +80,7 @@ class DataSourcePoolPropertiesCreatorTest {
Arrays.asList("username", "password", "closed"),
Collections.singletonList("closed"), Collections.singletonMap("username",
"user"));
when(dataSourcePoolProperties.getConnectionPropertySynonyms()).thenReturn(connectionPropertySynonyms);
when(dataSourcePoolProperties.getPoolPropertySynonyms()).thenReturn(poolPropertySynonyms);
-
when(dataSourcePoolProperties.getCustomDataSourcePoolProperties()).thenReturn(customDataSourcePoolProperties);
+
when(dataSourcePoolProperties.getCustomProperties()).thenReturn(customDataSourcePoolProperties);
DataSourcePoolPropertiesCreator.createConfiguration(dataSourcePoolProperties);
}
diff --git
a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/common/metadata/node/PipelineMetaDataNodeWatcher.java
b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/common/metadata/node/PipelineMetaDataNodeWatcher.java
index 3b748b4d159..c02c902aaf9 100644
---
a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/common/metadata/node/PipelineMetaDataNodeWatcher.java
+++
b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/common/metadata/node/PipelineMetaDataNodeWatcher.java
@@ -50,7 +50,7 @@ public final class PipelineMetaDataNodeWatcher {
private PipelineMetaDataNodeWatcher(final PipelineContextKey contextKey) {
listenerMap.putAll(ShardingSphereServiceLoader.getServiceInstances(PipelineMetaDataChangedEventHandler.class)
-
.stream().collect(Collectors.toMap(PipelineMetaDataChangedEventHandler::getKeyPattern,
each -> each, (key, value) -> value)));
+
.stream().collect(Collectors.toMap(PipelineMetaDataChangedEventHandler::getKeyPattern,
each -> each)));
PipelineAPIFactory.getGovernanceRepositoryAPI(contextKey).watch(DataPipelineConstants.DATA_PIPELINE_ROOT,
this::dispatchEvent);
}
diff --git
a/kernel/data-pipeline/scenario/migration/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/migration/api/impl/MigrationJobAPI.java
b/kernel/data-pipeline/scenario/migration/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/migration/api/impl/MigrationJobAPI.java
index 94fef5be039..87c162c7c07 100644
---
a/kernel/data-pipeline/scenario/migration/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/migration/api/impl/MigrationJobAPI.java
+++
b/kernel/data-pipeline/scenario/migration/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/migration/api/impl/MigrationJobAPI.java
@@ -490,7 +490,7 @@ public final class MigrationJobAPI extends
AbstractInventoryIncrementalJobAPIImp
props.add(getStandardProperty(standardProps, "maxPoolSize"));
props.add(getStandardProperty(standardProps, "minPoolSize"));
props.add(getStandardProperty(standardProps, "readOnly"));
- Map<String, Object> otherProps =
value.getCustomDataSourcePoolProperties().getProperties();
+ Map<String, Object> otherProps =
value.getCustomProperties().getProperties();
props.add(otherProps.isEmpty() ? "" : new
Gson().toJson(otherProps));
result.add(props);
}
diff --git
a/kernel/data-pipeline/scenario/migration/src/main/java/org/apache/shardingsphere/data/pipeline/yaml/job/YamlMigrationJobConfigurationSwapper.java
b/kernel/data-pipeline/scenario/migration/src/main/java/org/apache/shardingsphere/data/pipeline/yaml/job/YamlMigrationJobConfigurationSwapper.java
index 18da66b0bb0..33a5d97ff3c 100644
---
a/kernel/data-pipeline/scenario/migration/src/main/java/org/apache/shardingsphere/data/pipeline/yaml/job/YamlMigrationJobConfigurationSwapper.java
+++
b/kernel/data-pipeline/scenario/migration/src/main/java/org/apache/shardingsphere/data/pipeline/yaml/job/YamlMigrationJobConfigurationSwapper.java
@@ -44,7 +44,7 @@ public final class YamlMigrationJobConfigurationSwapper
implements YamlConfigura
result.setSourceDatabaseType(data.getSourceDatabaseType().getType());
result.setTargetDatabaseType(data.getTargetDatabaseType().getType());
result.setSources(data.getSources().entrySet().stream().collect(Collectors.toMap(Entry::getKey,
- entry ->
dataSourceConfigSwapper.swapToYamlConfiguration(entry.getValue()), (key, value)
-> value, LinkedHashMap::new)));
+ entry ->
dataSourceConfigSwapper.swapToYamlConfiguration(entry.getValue()), (oldValue,
currentValue) -> oldValue, LinkedHashMap::new)));
result.setTarget(dataSourceConfigSwapper.swapToYamlConfiguration(data.getTarget()));
result.setTargetTableNames(data.getTargetTableNames());
result.setTargetTableSchemaMap(data.getTargetTableSchemaMap());
@@ -60,7 +60,7 @@ public final class YamlMigrationJobConfigurationSwapper
implements YamlConfigura
return new MigrationJobConfiguration(yamlConfig.getJobId(),
yamlConfig.getDatabaseName(),
TypedSPILoader.getService(DatabaseType.class,
yamlConfig.getSourceDatabaseType()),
TypedSPILoader.getService(DatabaseType.class,
yamlConfig.getTargetDatabaseType()),
yamlConfig.getSources().entrySet().stream().collect(Collectors.toMap(Entry::getKey,
- entry ->
dataSourceConfigSwapper.swapToObject(entry.getValue()), (key, value) -> value,
LinkedHashMap::new)),
+ entry ->
dataSourceConfigSwapper.swapToObject(entry.getValue()), (oldValue,
currentValue) -> oldValue, LinkedHashMap::new)),
dataSourceConfigSwapper.swapToObject(yamlConfig.getTarget()),
yamlConfig.getTargetTableNames(),
yamlConfig.getTargetTableSchemaMap(),
JobDataNodeLine.unmarshal(yamlConfig.getTablesFirstDataNodes()),
yamlConfig.getJobShardingDataNodes().stream().map(JobDataNodeLine::unmarshal).collect(Collectors.toList()),
diff --git
a/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/MetaDataPersistService.java
b/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/MetaDataPersistService.java
index 665e7f3c654..84f3d3b9219 100644
---
a/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/MetaDataPersistService.java
+++
b/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/MetaDataPersistService.java
@@ -130,11 +130,11 @@ public final class MetaDataPersistService implements
MetaDataBasedPersistService
@Override
public Map<String, DataSourceConfiguration> getEffectiveDataSources(final
String databaseName, final Map<String, ? extends DatabaseConfiguration>
databaseConfigs) {
- Map<String, DataSourcePoolProperties> persistedDataPropsMap =
dataSourceUnitService.load(databaseName);
+ Map<String, DataSourcePoolProperties> propsMap =
dataSourceUnitService.load(databaseName);
if (databaseConfigs.containsKey(databaseName) &&
!databaseConfigs.get(databaseName).getDataSources().isEmpty()) {
databaseConfigs.get(databaseName).getStorageResource().getStorageNodeDataSources().values().forEach(each
-> new DataSourcePoolDestroyer(each).asyncDestroy());
}
- return
persistedDataPropsMap.entrySet().stream().collect(Collectors.toMap(Entry::getKey,
- entry ->
DataSourcePoolPropertiesCreator.createConfiguration(entry.getValue()), (key,
value) -> value, LinkedHashMap::new));
+ return
propsMap.entrySet().stream().collect(Collectors.toMap(Entry::getKey,
+ entry ->
DataSourcePoolPropertiesCreator.createConfiguration(entry.getValue()),
(oldValue, currentValue) -> oldValue, LinkedHashMap::new));
}
}
diff --git
a/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/NewMetaDataPersistService.java
b/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/NewMetaDataPersistService.java
index b921183f361..9000d49de0a 100644
---
a/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/NewMetaDataPersistService.java
+++
b/kernel/metadata/core/src/main/java/org/apache/shardingsphere/metadata/persist/NewMetaDataPersistService.java
@@ -143,11 +143,11 @@ public final class NewMetaDataPersistService implements
MetaDataBasedPersistServ
*/
@Override
public Map<String, DataSourceConfiguration> getEffectiveDataSources(final
String databaseName, final Map<String, ? extends DatabaseConfiguration>
databaseConfigs) {
- Map<String, DataSourcePoolProperties> persistedDataPropsMap =
dataSourceUnitService.load(databaseName);
+ Map<String, DataSourcePoolProperties> propsMap =
dataSourceUnitService.load(databaseName);
if (databaseConfigs.containsKey(databaseName) &&
!databaseConfigs.get(databaseName).getDataSources().isEmpty()) {
databaseConfigs.get(databaseName).getStorageResource().getStorageNodeDataSources().values().forEach(each
-> new DataSourcePoolDestroyer(each).asyncDestroy());
}
- return
persistedDataPropsMap.entrySet().stream().collect(Collectors.toMap(Entry::getKey,
- entry ->
DataSourcePoolPropertiesCreator.createConfiguration(entry.getValue()), (key,
value) -> value, LinkedHashMap::new));
+ return
propsMap.entrySet().stream().collect(Collectors.toMap(Entry::getKey,
+ entry ->
DataSourcePoolPropertiesCreator.createConfiguration(entry.getValue()),
(oldValue, currentValue) -> oldValue, LinkedHashMap::new));
}
}
diff --git
a/kernel/time-service/type/database/src/main/java/org/apache/shardingsphere/timeservice/type/database/DatabaseTimestampService.java
b/kernel/time-service/type/database/src/main/java/org/apache/shardingsphere/timeservice/type/database/DatabaseTimestampService.java
index 19594050587..5dea456923c 100644
---
a/kernel/time-service/type/database/src/main/java/org/apache/shardingsphere/timeservice/type/database/DatabaseTimestampService.java
+++
b/kernel/time-service/type/database/src/main/java/org/apache/shardingsphere/timeservice/type/database/DatabaseTimestampService.java
@@ -49,7 +49,7 @@ public final class DatabaseTimestampService implements
TimestampService {
@Override
public void init(final Properties props) {
dataSource = DataSourcePoolCreator.create(new
YamlDataSourceConfigurationSwapper().swapToDataSourcePoolProperties(
- props.entrySet().stream().collect(Collectors.toMap(entry ->
entry.getKey().toString(), Entry::getValue, (key, value) -> value))));
+ props.entrySet().stream().collect(Collectors.toMap(entry ->
entry.getKey().toString(), Entry::getValue))));
storageType =
DatabaseTypeEngine.getStorageType(Collections.singleton(dataSource));
}
diff --git
a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/MetaDataContextsFactory.java
b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/MetaDataContextsFactory.java
index f49e529f63e..e4d73ddc0bd 100644
---
a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/MetaDataContextsFactory.java
+++
b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/MetaDataContextsFactory.java
@@ -110,8 +110,7 @@ public final class MetaDataContextsFactory {
private static Map<String, DatabaseConfiguration>
createEffectiveDatabaseConfigurations(final Collection<String> databaseNames,
final Map<String, DatabaseConfiguration> databaseConfigs, final
MetaDataPersistService persistService) {
- return databaseNames.stream().collect(
- Collectors.toMap(each -> each, each ->
createEffectiveDatabaseConfiguration(each, databaseConfigs, persistService),
(a, b) -> b, () -> new HashMap<>(databaseNames.size(), 1F)));
+ return databaseNames.stream().collect(Collectors.toMap(each -> each,
each -> createEffectiveDatabaseConfiguration(each, databaseConfigs,
persistService)));
}
private static DatabaseConfiguration
createEffectiveDatabaseConfiguration(final String databaseName,
diff --git
a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/NewMetaDataContextsFactory.java
b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/NewMetaDataContextsFactory.java
index 067f560fc8a..2b117a0d76a 100644
---
a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/NewMetaDataContextsFactory.java
+++
b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/NewMetaDataContextsFactory.java
@@ -112,8 +112,7 @@ public final class NewMetaDataContextsFactory {
private static Map<String, DatabaseConfiguration>
createEffectiveDatabaseConfigurations(final Collection<String> databaseNames,
final Map<String, DatabaseConfiguration> databaseConfigs, final
NewMetaDataPersistService persistService) {
- return databaseNames.stream().collect(
- Collectors.toMap(each -> each, each ->
createEffectiveDatabaseConfiguration(each, databaseConfigs, persistService),
(a, b) -> b, () -> new HashMap<>(databaseNames.size(), 1F)));
+ return databaseNames.stream().collect(Collectors.toMap(each -> each,
each -> createEffectiveDatabaseConfiguration(each, databaseConfigs,
persistService)));
}
private static DatabaseConfiguration
createEffectiveDatabaseConfiguration(final String databaseName,
diff --git
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ConvertYamlConfigurationExecutor.java
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ConvertYamlConfigurationExecutor.java
index d2c1d5cd24b..29384c18dab 100644
---
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ConvertYamlConfigurationExecutor.java
+++
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ConvertYamlConfigurationExecutor.java
@@ -135,7 +135,7 @@ public final class ConvertYamlConfigurationExecutor
implements QueryableRALExecu
String url = (String)
connectionProps.get(DistSQLScriptConstants.KEY_URL);
String username = (String)
connectionProps.get(DistSQLScriptConstants.KEY_USERNAME);
String password = (String)
connectionProps.get(DistSQLScriptConstants.KEY_PASSWORD);
- String props =
getResourceProperties(dataSourcePoolProps.getPoolPropertySynonyms(),
dataSourcePoolProps.getCustomDataSourcePoolProperties());
+ String props =
getResourceProperties(dataSourcePoolProps.getPoolPropertySynonyms(),
dataSourcePoolProps.getCustomProperties());
if (Strings.isNullOrEmpty(password)) {
stringBuilder.append(String.format(DistSQLScriptConstants.RESOURCE_DEFINITION_WITHOUT_PASSWORD,
resourceName, url, username, props));
} else {
diff --git
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/storage/unit/ShowStorageUnitExecutor.java
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/storage/unit/ShowStorageUnitExecutor.java
index 51a72486d4a..ace4287f092 100644
---
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/storage/unit/ShowStorageUnitExecutor.java
+++
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/storage/unit/ShowStorageUnitExecutor.java
@@ -73,7 +73,7 @@ public final class ShowStorageUnitExecutor implements
RQLExecutor<ShowStorageUni
DataSourcePoolProperties props = entry.getValue();
ConnectionProperties connectionProps =
resourceMetaData.getConnectionProperties(key);
Map<String, Object> standardProps =
props.getPoolPropertySynonyms().getStandardProperties();
- Map<String, Object> otherProps =
props.getCustomDataSourcePoolProperties().getProperties();
+ Map<String, Object> otherProps =
props.getCustomProperties().getProperties();
result.add(new LocalDataQueryResultRow(key,
resourceMetaData.getStorageType(key).getType(),
connectionProps.getHostname(),
diff --git
a/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/information/SelectInformationSchemataExecutorTest.java
b/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/information/SelectInformationSchemataExecutorTest.java
index 35823fba6d6..008d1dfd9c1 100644
---
a/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/information/SelectInformationSchemataExecutorTest.java
+++
b/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/information/SelectInformationSchemataExecutorTest.java
@@ -152,7 +152,7 @@ class SelectInformationSchemataExecutorTest {
when(shardingSphereDataPersistService.load(any())).thenReturn(Optional.empty());
when(metaDataPersistService.getShardingSphereDataPersistService()).thenReturn(shardingSphereDataPersistService);
MetaDataContexts metaDataContexts = new
MetaDataContexts(metaDataPersistService, new ShardingSphereMetaData(
-
Arrays.stream(databases).collect(Collectors.toMap(ShardingSphereDatabase::getName,
each -> each, (key, value) -> value)),
+
Arrays.stream(databases).collect(Collectors.toMap(ShardingSphereDatabase::getName,
each -> each)),
mock(ResourceMetaData.class), new
RuleMetaData(Collections.singleton(authorityRule)), new
ConfigurationProperties(new Properties())));
when(result.getMetaDataContexts()).thenReturn(metaDataContexts);
return result;