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 58ed3013690 Remove useless class and method (#31601)
58ed3013690 is described below
commit 58ed30136902513e789e296948da4a0db3175b77
Author: Haoran Meng <[email protected]>
AuthorDate: Thu Jun 6 15:04:31 2024 +0800
Remove useless class and method (#31601)
---
.../exception/UnavailableDataSourceException.java | 38 ----------------------
.../mode/metadata/MetaDataContextsFactory.java | 17 ----------
2 files changed, 55 deletions(-)
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/state/datasource/exception/UnavailableDataSourceException.java
b/infra/common/src/main/java/org/apache/shardingsphere/infra/state/datasource/exception/UnavailableDataSourceException.java
deleted file mode 100644
index 888db2dd95f..00000000000
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/state/datasource/exception/UnavailableDataSourceException.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.infra.state.datasource.exception;
-
-import
org.apache.shardingsphere.infra.exception.core.external.server.ShardingSphereServerException;
-
-import java.sql.SQLException;
-
-/**
- * Data source state exception.
- */
-public final class UnavailableDataSourceException extends
ShardingSphereServerException {
-
- private static final long serialVersionUID = -8058761885303180333L;
-
- private static final String ERROR_CATEGORY = "DATA-SOURCE";
-
- private static final int ERROR_CODE = 1;
-
- public UnavailableDataSourceException(final String dataSourceName, final
SQLException cause) {
- super(ERROR_CATEGORY, ERROR_CODE, String.format("Data source '%s' is
unavailable.", dataSourceName), cause);
- }
-}
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 fefaef1ede1..4f1d9ca6de5 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
@@ -17,8 +17,6 @@
package org.apache.shardingsphere.mode.metadata;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Splitter;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.shardingsphere.infra.config.database.DatabaseConfiguration;
@@ -44,7 +42,6 @@ import
org.apache.shardingsphere.infra.metadata.statistics.ShardingSphereTableDa
import
org.apache.shardingsphere.infra.metadata.statistics.builder.ShardingSphereStatisticsBuilder;
import org.apache.shardingsphere.infra.rule.builder.global.GlobalRulesBuilder;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
-import org.apache.shardingsphere.infra.state.datasource.DataSourceState;
import org.apache.shardingsphere.metadata.factory.ExternalMetaDataFactory;
import org.apache.shardingsphere.metadata.factory.InternalMetaDataFactory;
import org.apache.shardingsphere.metadata.persist.MetaDataPersistService;
@@ -55,9 +52,7 @@ import javax.sql.DataSource;
import java.sql.SQLException;
import java.util.Collection;
import java.util.Collections;
-import java.util.HashMap;
import java.util.LinkedHashMap;
-import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
@@ -153,18 +148,6 @@ public final class MetaDataContextsFactory {
}
}
- private static Map<String, DataSourceState>
getStorageDataSourceStates(final Map<String, QualifiedDataSourceState>
statusMap) {
- Map<String, DataSourceState> result = new HashMap<>(statusMap.size(),
1F);
- statusMap.forEach((key, value) -> {
- List<String> values = Splitter.on(".").splitToList(key);
- Preconditions.checkArgument(3 == values.size(), "Illegal data
source of storage node.");
- String databaseName = values.get(0);
- String dataSourceName = values.get(2);
- result.put(databaseName + "." + dataSourceName,
DataSourceState.valueOf(value.getStatus().name()));
- });
- return result;
- }
-
private static ShardingSphereStatistics initStatistics(final
MetaDataPersistService persistService, final ShardingSphereMetaData metaData) {
if (metaData.getDatabases().isEmpty()) {
return new ShardingSphereStatistics();