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/06/17 08:13:40 UTC
(shardingsphere) branch master updated: Code format for DriverDatabaseConnectionManager (#31731)
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 49797ce3daa Code format for DriverDatabaseConnectionManager (#31731)
49797ce3daa is described below
commit 49797ce3daa4058f1d0faed3936dc6483c8d1d5e
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Mon Jun 17 16:13:33 2024 +0800
Code format for DriverDatabaseConnectionManager (#31731)
---
.../jdbc/core/connection/DriverDatabaseConnectionManager.java | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/core/connection/DriverDatabaseConnectionManager.java b/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/core/connection/DriverDatabaseConnectionManager.java
index 2aede3b707a..3caa18ede4a 100644
--- a/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/core/connection/DriverDatabaseConnectionManager.java
+++ b/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/core/connection/DriverDatabaseConnectionManager.java
@@ -360,9 +360,7 @@ public final class DriverDatabaseConnectionManager implements OnlineDatabaseConn
private List<Connection> getConnections(final String currentDatabaseName, final String dataSourceName, final int connectionOffset, final int connectionSize,
final ConnectionMode connectionMode) throws SQLException {
String cacheKey = getKey(currentDatabaseName, dataSourceName);
- DataSource dataSource = databaseName.equals(currentDatabaseName)
- ? dataSourceMap.get(cacheKey)
- : contextManager.getStorageUnits(currentDatabaseName).get(dataSourceName).getDataSource();
+ DataSource dataSource = databaseName.equals(currentDatabaseName) ? dataSourceMap.get(cacheKey) : contextManager.getStorageUnits(currentDatabaseName).get(dataSourceName).getDataSource();
Preconditions.checkNotNull(dataSource, "Missing the data source name: '%s'", dataSourceName);
Collection<Connection> connections;
synchronized (cachedConnections) {
@@ -431,8 +429,9 @@ public final class DriverDatabaseConnectionManager implements OnlineDatabaseConn
private Connection createConnection(final String databaseName, final String dataSourceName, final DataSource dataSource,
final TransactionConnectionContext transactionConnectionContext) throws SQLException {
- Optional<Connection> connectionInTransaction =
- isRawJdbcDataSource(databaseName, dataSourceName) ? getConnectionTransaction().getConnection(databaseName, dataSourceName, transactionConnectionContext) : Optional.empty();
+ Optional<Connection> connectionInTransaction = isRawJdbcDataSource(databaseName, dataSourceName)
+ ? getConnectionTransaction().getConnection(databaseName, dataSourceName, transactionConnectionContext)
+ : Optional.empty();
return connectionInTransaction.isPresent() ? connectionInTransaction.get() : dataSource.getConnection();
}