You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2024/12/01 12:35:13 UTC
(shardingsphere) branch master updated: Remove useless ShardingSphereDatabase's Map schemas constructor (#33867)
This is an automated email from the ASF dual-hosted git repository.
zhangliang 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 73d868c6def Remove useless ShardingSphereDatabase's Map schemas constructor (#33867)
73d868c6def is described below
commit 73d868c6defac8834043cbd0aa191739398d0669
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Sun Dec 1 20:35:07 2024 +0800
Remove useless ShardingSphereDatabase's Map schemas constructor (#33867)
---
.../infra/metadata/database/ShardingSphereDatabase.java | 16 +++-------------
1 file changed, 3 insertions(+), 13 deletions(-)
diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/ShardingSphereDatabase.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/ShardingSphereDatabase.java
index 29ead3212f0..f78c5c6f796 100644
--- a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/ShardingSphereDatabase.java
+++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/ShardingSphereDatabase.java
@@ -64,15 +64,6 @@ public final class ShardingSphereDatabase {
@Getter(AccessLevel.NONE)
private final Map<ShardingSphereMetaDataIdentifier, ShardingSphereSchema> schemas;
- public ShardingSphereDatabase(final String name, final DatabaseType protocolType, final ResourceMetaData resourceMetaData,
- final RuleMetaData ruleMetaData, final Map<String, ShardingSphereSchema> schemas) {
- this.name = name;
- this.protocolType = protocolType;
- this.resourceMetaData = resourceMetaData;
- this.ruleMetaData = ruleMetaData;
- this.schemas = new ConcurrentHashMap<>(schemas.entrySet().stream().collect(Collectors.toMap(entry -> new ShardingSphereMetaDataIdentifier(entry.getKey()), Entry::getValue)));
- }
-
public ShardingSphereDatabase(final String name, final DatabaseType protocolType, final ResourceMetaData resourceMetaData,
final RuleMetaData ruleMetaData, final Collection<ShardingSphereSchema> schemas) {
this.name = name;
@@ -93,7 +84,7 @@ public final class ShardingSphereDatabase {
public static ShardingSphereDatabase create(final String name, final DatabaseType protocolType, final ConfigurationProperties props) {
DatabaseConfiguration databaseConfig = new DataSourceProvidedDatabaseConfiguration(new LinkedHashMap<>(), new LinkedList<>());
ResourceMetaData resourceMetaData = new ResourceMetaData(databaseConfig.getDataSources(), databaseConfig.getStorageUnits());
- return new ShardingSphereDatabase(name, protocolType, resourceMetaData, new RuleMetaData(new LinkedList<ShardingSphereRule>()), SystemSchemaBuilder.build(name, protocolType, props).values());
+ return new ShardingSphereDatabase(name, protocolType, resourceMetaData, new RuleMetaData(new LinkedList<>()), SystemSchemaBuilder.build(name, protocolType, props).values());
}
/**
@@ -108,9 +99,8 @@ public final class ShardingSphereDatabase {
* @return created database
* @throws SQLException SQL exception
*/
- public static ShardingSphereDatabase create(final String name, final DatabaseType protocolType, final Map<String, DatabaseType> storageTypes,
- final DatabaseConfiguration databaseConfig, final ConfigurationProperties props,
- final ComputeNodeInstanceContext computeNodeInstanceContext) throws SQLException {
+ public static ShardingSphereDatabase create(final String name, final DatabaseType protocolType, final Map<String, DatabaseType> storageTypes, final DatabaseConfiguration databaseConfig,
+ final ConfigurationProperties props, final ComputeNodeInstanceContext computeNodeInstanceContext) throws SQLException {
ResourceMetaData resourceMetaData = new ResourceMetaData(databaseConfig.getDataSources(), databaseConfig.getStorageUnits());
Collection<ShardingSphereRule> databaseRules = DatabaseRulesBuilder.build(name, protocolType, databaseConfig, computeNodeInstanceContext, resourceMetaData);
Map<String, ShardingSphereSchema> schemas = new ConcurrentHashMap<>(GenericSchemaBuilder.build(new GenericSchemaBuilderMaterial(