This is an automated email from the ASF dual-hosted git repository.
zhonghongsheng 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 783d6bbd20b Remove useless CacheableExecutorConnectionManager (#25495)
783d6bbd20b is described below
commit 783d6bbd20bd032078a310c2995987c5cbcf994c
Author: Liang Zhang <[email protected]>
AuthorDate: Sat May 6 17:51:33 2023 +0800
Remove useless CacheableExecutorConnectionManager (#25495)
---
.../driver/CacheableExecutorConnectionManager.java | 35 ----------------------
.../prepare/driver/ExecutorConnectionManager.java | 8 +++++
.../jdbc/core/connection/ConnectionManager.java | 4 +--
.../proxy/backend/connector/BackendConnection.java | 4 +--
.../proxy/backend/session/ConnectionSession.java | 4 +--
5 files changed, 14 insertions(+), 41 deletions(-)
diff --git
a/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/prepare/driver/CacheableExecutorConnectionManager.java
b/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/prepare/driver/CacheableExecutorConnectionManager.java
deleted file mode 100644
index 8b10910af49..00000000000
---
a/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/prepare/driver/CacheableExecutorConnectionManager.java
+++ /dev/null
@@ -1,35 +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.executor.sql.prepare.driver;
-
-import java.util.Collection;
-
-/**
- * Executor connection manager which is able to cache connections.
- *
- * @param <C> type of resource connection
- */
-public interface CacheableExecutorConnectionManager<C> extends
ExecutorConnectionManager<C> {
-
- /**
- * Get data source names of cached connections.
- *
- * @return data source names of cached connections
- */
- Collection<String> getDataSourceNamesOfCachedConnections();
-}
diff --git
a/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/prepare/driver/ExecutorConnectionManager.java
b/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/prepare/driver/ExecutorConnectionManager.java
index 6bf56003fcf..0182ae295fe 100644
---
a/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/prepare/driver/ExecutorConnectionManager.java
+++
b/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/prepare/driver/ExecutorConnectionManager.java
@@ -20,6 +20,7 @@ package
org.apache.shardingsphere.infra.executor.sql.prepare.driver;
import
org.apache.shardingsphere.infra.executor.sql.execute.engine.ConnectionMode;
import java.sql.SQLException;
+import java.util.Collection;
import java.util.List;
/**
@@ -39,4 +40,11 @@ public interface ExecutorConnectionManager<C> {
* @throws SQLException SQL exception
*/
List<C> getConnections(String dataSourceName, int connectionSize,
ConnectionMode connectionMode) throws SQLException;
+
+ /**
+ * Get data source names of cached connections.
+ *
+ * @return data source names of cached connections
+ */
+ Collection<String> getDataSourceNamesOfCachedConnections();
}
diff --git
a/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/connection/ConnectionManager.java
b/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/connection/ConnectionManager.java
index 9ca75375ffb..43c11938116 100644
---
a/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/connection/ConnectionManager.java
+++
b/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/connection/ConnectionManager.java
@@ -31,7 +31,7 @@ import
org.apache.shardingsphere.infra.datasource.pool.creator.DataSourcePoolCre
import org.apache.shardingsphere.infra.datasource.props.DataSourceProperties;
import
org.apache.shardingsphere.infra.exception.OverallConnectionNotEnoughException;
import
org.apache.shardingsphere.infra.executor.sql.execute.engine.ConnectionMode;
-import
org.apache.shardingsphere.infra.executor.sql.prepare.driver.CacheableExecutorConnectionManager;
+import
org.apache.shardingsphere.infra.executor.sql.prepare.driver.ExecutorConnectionManager;
import org.apache.shardingsphere.infra.instance.metadata.InstanceMetaData;
import org.apache.shardingsphere.infra.instance.metadata.InstanceType;
import
org.apache.shardingsphere.infra.instance.metadata.proxy.ProxyInstanceMetaData;
@@ -62,7 +62,7 @@ import java.util.Random;
/**
* Connection manager.
*/
-public final class ConnectionManager implements
CacheableExecutorConnectionManager<Connection>, AutoCloseable {
+public final class ConnectionManager implements
ExecutorConnectionManager<Connection>, AutoCloseable {
private final Map<String, DataSource> dataSourceMap = new
LinkedHashMap<>();
diff --git
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/connector/BackendConnection.java
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/connector/BackendConnection.java
index 2c7e938a656..4efa358fb64 100644
---
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/connector/BackendConnection.java
+++
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/connector/BackendConnection.java
@@ -23,7 +23,7 @@ import com.google.common.collect.Multimap;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import
org.apache.shardingsphere.infra.executor.sql.execute.engine.ConnectionMode;
-import
org.apache.shardingsphere.infra.executor.sql.prepare.driver.CacheableExecutorConnectionManager;
+import
org.apache.shardingsphere.infra.executor.sql.prepare.driver.ExecutorConnectionManager;
import org.apache.shardingsphere.infra.util.spi.ShardingSphereServiceLoader;
import
org.apache.shardingsphere.proxy.backend.connector.jdbc.connection.ConnectionPostProcessor;
import
org.apache.shardingsphere.proxy.backend.connector.jdbc.connection.ResourceLock;
@@ -51,7 +51,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
*/
@RequiredArgsConstructor
@Getter
-public final class BackendConnection implements
CacheableExecutorConnectionManager<Connection> {
+public final class BackendConnection implements
ExecutorConnectionManager<Connection> {
private final ConnectionSession connectionSession;
diff --git
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/session/ConnectionSession.java
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/session/ConnectionSession.java
index 7e5b1cb99f1..5d52999b2a5 100644
---
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/session/ConnectionSession.java
+++
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/session/ConnectionSession.java
@@ -24,7 +24,7 @@ import lombok.Setter;
import org.apache.shardingsphere.infra.binder.QueryContext;
import org.apache.shardingsphere.infra.connection.ConnectionContext;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import
org.apache.shardingsphere.infra.executor.sql.prepare.driver.CacheableExecutorConnectionManager;
+import
org.apache.shardingsphere.infra.executor.sql.prepare.driver.ExecutorConnectionManager;
import
org.apache.shardingsphere.infra.executor.sql.prepare.driver.ExecutorStatementManager;
import org.apache.shardingsphere.infra.metadata.user.Grantee;
import org.apache.shardingsphere.proxy.backend.connector.BackendConnection;
@@ -81,7 +81,7 @@ public final class ConnectionSession {
this.attributeMap = attributeMap;
backendConnection = new BackendConnection(this);
statementManager = new JDBCBackendStatement();
- connectionContext = new
ConnectionContext(((CacheableExecutorConnectionManager<?>)
backendConnection)::getDataSourceNamesOfCachedConnections);
+ connectionContext = new
ConnectionContext(((ExecutorConnectionManager<?>)
backendConnection)::getDataSourceNamesOfCachedConnections);
}
/**