Polishing

This commit is contained in:
Juergen Hoeller
2018-09-17 14:26:56 +02:00
parent 34663300a6
commit 51f7a3e40f
3 changed files with 14 additions and 25 deletions

View File

@@ -160,16 +160,12 @@ public class LazyConnectionDataSourceProxy extends DelegatingDataSource {
// via a Connection from the target DataSource, if possible.
if (this.defaultAutoCommit == null || this.defaultTransactionIsolation == null) {
try {
Connection con = obtainTargetDataSource().getConnection();
try {
try (Connection con = obtainTargetDataSource().getConnection()) {
checkDefaultConnectionProperties(con);
}
finally {
con.close();
}
}
catch (SQLException ex) {
logger.info("Could not retrieve default auto-commit and transaction isolation settings", ex);
logger.debug("Could not retrieve default auto-commit and transaction isolation settings", ex);
}
}
}
@@ -411,8 +407,8 @@ public class LazyConnectionDataSourceProxy extends DelegatingDataSource {
private Connection getTargetConnection(Method operation) throws SQLException {
if (this.target == null) {
// No target Connection held -> fetch one.
if (logger.isDebugEnabled()) {
logger.debug("Connecting to database for operation '" + operation.getName() + "'");
if (logger.isTraceEnabled()) {
logger.trace("Connecting to database for operation '" + operation.getName() + "'");
}
// Fetch physical Connection from DataSource.
@@ -444,8 +440,8 @@ public class LazyConnectionDataSourceProxy extends DelegatingDataSource {
else {
// Target Connection already held -> return it.
if (logger.isDebugEnabled()) {
logger.debug("Using existing database connection for operation '" + operation.getName() + "'");
if (logger.isTraceEnabled()) {
logger.trace("Using existing database connection for operation '" + operation.getName() + "'");
}
}