This is an automated email from the ASF dual-hosted git repository.

duanzhengqiang 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 9f6f2d4  Set loadFactor of HashMap (#12664)
9f6f2d4 is described below

commit 9f6f2d4e90a76067a711eafff2421feae8632581
Author: yx9o <[email protected]>
AuthorDate: Fri Sep 24 09:02:26 2021 +0800

    Set loadFactor of HashMap (#12664)
---
 .../shardingsphere/dbdiscovery/rule/DatabaseDiscoveryRule.java      | 2 +-
 .../main/java/org/apache/shardingsphere/shadow/rule/ShadowRule.java | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/rule/DatabaseDiscoveryRule.java
 
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/rule/DatabaseDiscoveryRule.java
index c8cab3a..b5a927f 100644
--- 
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/rule/DatabaseDiscoveryRule.java
+++ 
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/rule/DatabaseDiscoveryRule.java
@@ -78,7 +78,7 @@ public final class DatabaseDiscoveryRule implements 
SchemaRule, DataSourceContai
     }
     
     private static Map<String, DatabaseDiscoveryType> getDiscoveryTypes(final 
Map<String, ShardingSphereAlgorithmConfiguration> discoveryTypesConfig) {
-        Map<String, DatabaseDiscoveryType> result = new LinkedHashMap<>();
+        Map<String, DatabaseDiscoveryType> result = new 
LinkedHashMap<>(discoveryTypesConfig.size(), 1);
         for (Entry<String, ShardingSphereAlgorithmConfiguration> entry : 
discoveryTypesConfig.entrySet()) {
             result.put(entry.getKey(), 
ShardingSphereAlgorithmFactory.createAlgorithm(entry.getValue(), 
DatabaseDiscoveryType.class));
         }
diff --git 
a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/rule/ShadowRule.java
 
b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/rule/ShadowRule.java
index 146e625..ee86c66 100644
--- 
a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/rule/ShadowRule.java
+++ 
b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/rule/ShadowRule.java
@@ -67,7 +67,7 @@ public final class ShadowRule implements SchemaRule, 
DataSourceContainedRule {
     public ShadowRule(final ShadowRuleConfiguration shadowRuleConfig) {
         enable = shadowRuleConfig.isEnable();
         column = shadowRuleConfig.getColumn();
-        shadowMappings = new 
HashMap<>(shadowRuleConfig.getShadowDataSourceNames().size());
+        shadowMappings = new 
HashMap<>(shadowRuleConfig.getShadowDataSourceNames().size(), 1);
         for (int i = 0; i < 
shadowRuleConfig.getSourceDataSourceNames().size(); i++) {
             
shadowMappings.put(shadowRuleConfig.getSourceDataSourceNames().get(i), 
shadowRuleConfig.getShadowDataSourceNames().get(i));
         }
@@ -81,7 +81,7 @@ public final class ShadowRule implements SchemaRule, 
DataSourceContainedRule {
     public ShadowRule(final AlgorithmProvidedShadowRuleConfiguration 
shadowRuleConfig) {
         enable = shadowRuleConfig.isEnable();
         column = shadowRuleConfig.getColumn();
-        shadowMappings = new 
HashMap<>(shadowRuleConfig.getShadowDataSourceNames().size());
+        shadowMappings = new 
HashMap<>(shadowRuleConfig.getShadowDataSourceNames().size(), 1);
         for (int i = 0; i < 
shadowRuleConfig.getSourceDataSourceNames().size(); i++) {
             
shadowMappings.put(shadowRuleConfig.getSourceDataSourceNames().get(i), 
shadowRuleConfig.getShadowDataSourceNames().get(i));
         }
@@ -207,7 +207,7 @@ public final class ShadowRule implements SchemaRule, 
DataSourceContainedRule {
     
     @Override
     public Map<String, Collection<String>> getDataSourceMapper() {
-        Map<String, Collection<String>> result = new 
HashMap<>(shadowMappings.size());
+        Map<String, Collection<String>> result = new 
HashMap<>(shadowMappings.size(), 1);
         for (Entry<String, String> entry : shadowMappings.entrySet()) {
             result.put(entry.getKey(), 
Collections.singletonList(entry.getValue()));
         }

Reply via email to