Skip to content

Commit 9d504c8

Browse files
committed
Avoid log statements between resource opening and returning
Issue: SPR-17559 (cherry picked from commit 7854b7a)
1 parent 191a2d3 commit 9d504c8

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

spring-jdbc/src/main/java/org/springframework/jdbc/datasource/DataSourceUtils.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -111,7 +111,6 @@ public static Connection doGetConnection(DataSource dataSource) throws SQLExcept
111111
Connection con = dataSource.getConnection();
112112

113113
if (TransactionSynchronizationManager.isSynchronizationActive()) {
114-
logger.debug("Registering transaction synchronization for JDBC Connection");
115114
// Use same Connection for further JDBC actions within the transaction.
116115
// Thread-bound object will get removed by synchronization at transaction completion.
117116
ConnectionHolder holderToUse = conHolder;
@@ -326,7 +325,6 @@ public static void doReleaseConnection(Connection con, DataSource dataSource) th
326325
return;
327326
}
328327
}
329-
logger.debug("Returning JDBC Connection to DataSource");
330328
doCloseConnection(con, dataSource);
331329
}
332330

spring-orm/src/main/java/org/springframework/orm/jpa/EntityManagerFactoryUtils.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public static EntityManagerFactory findEntityManagerFactory(
148148
* Obtain a JPA EntityManager from the given factory. Is aware of a corresponding
149149
* EntityManager bound to the current thread, e.g. when using JpaTransactionManager.
150150
* <p>Note: Will return {@code null} if no thread-bound EntityManager found!
151-
* @param emf EntityManagerFactory to create the EntityManager with
151+
* @param emf the EntityManagerFactory to create the EntityManager with
152152
* @return the EntityManager, or {@code null} if none found
153153
* @throws DataAccessResourceFailureException if the EntityManager couldn't be obtained
154154
* @see JpaTransactionManager
@@ -163,7 +163,7 @@ public static EntityManager getTransactionalEntityManager(EntityManagerFactory e
163163
* Obtain a JPA EntityManager from the given factory. Is aware of a corresponding
164164
* EntityManager bound to the current thread, e.g. when using JpaTransactionManager.
165165
* <p>Note: Will return {@code null} if no thread-bound EntityManager found!
166-
* @param emf EntityManagerFactory to create the EntityManager with
166+
* @param emf the EntityManagerFactory to create the EntityManager with
167167
* @param properties the properties to be passed into the {@code createEntityManager}
168168
* call (may be {@code null})
169169
* @return the EntityManager, or {@code null} if none found
@@ -184,7 +184,7 @@ public static EntityManager getTransactionalEntityManager(EntityManagerFactory e
184184
* Obtain a JPA EntityManager from the given factory. Is aware of a corresponding
185185
* EntityManager bound to the current thread, e.g. when using JpaTransactionManager.
186186
* <p>Same as {@code getEntityManager}, but throwing the original PersistenceException.
187-
* @param emf EntityManagerFactory to create the EntityManager with
187+
* @param emf the EntityManagerFactory to create the EntityManager with
188188
* @param properties the properties to be passed into the {@code createEntityManager}
189189
* call (may be {@code null})
190190
* @return the EntityManager, or {@code null} if none found
@@ -202,7 +202,7 @@ public static EntityManager doGetTransactionalEntityManager(EntityManagerFactory
202202
* Obtain a JPA EntityManager from the given factory. Is aware of a corresponding
203203
* EntityManager bound to the current thread, e.g. when using JpaTransactionManager.
204204
* <p>Same as {@code getEntityManager}, but throwing the original PersistenceException.
205-
* @param emf EntityManagerFactory to create the EntityManager with
205+
* @param emf the EntityManagerFactory to create the EntityManager with
206206
* @param properties the properties to be passed into the {@code createEntityManager}
207207
* call (may be {@code null})
208208
* @param synchronizedWithTransaction whether to automatically join ongoing
@@ -287,7 +287,6 @@ else if (!TransactionSynchronizationManager.isSynchronizationActive()) {
287287

288288
// Use same EntityManager for further JPA operations within the transaction.
289289
// Thread-bound object will get removed by synchronization at transaction completion.
290-
logger.debug("Registering transaction synchronization for JPA EntityManager");
291290
emHolder = new EntityManagerHolder(em);
292291
if (synchronizedWithTransaction) {
293292
Object transactionData = prepareTransaction(em, emf);
@@ -347,7 +346,7 @@ private static void cleanupTransaction(Object transactionData, EntityManagerFact
347346
* Apply the current transaction timeout, if any, to the given JPA Query object.
348347
* <p>This method sets the JPA 2.0 query hint "javax.persistence.query.timeout" accordingly.
349348
* @param query the JPA Query object
350-
* @param emf JPA EntityManagerFactory that the Query was created for
349+
* @param emf the JPA EntityManagerFactory that the Query was created for
351350
*/
352351
public static void applyTransactionTimeout(Query query, EntityManagerFactory emf) {
353352
EntityManagerHolder emHolder = (EntityManagerHolder) TransactionSynchronizationManager.getResource(emf);
@@ -432,7 +431,6 @@ public static DataAccessException convertJpaAccessExceptionIfPossible(RuntimeExc
432431
*/
433432
public static void closeEntityManager(EntityManager em) {
434433
if (em != null) {
435-
logger.debug("Closing JPA EntityManager");
436434
try {
437435
if (em.isOpen()) {
438436
em.close();

spring-tx/src/main/java/org/springframework/jca/cci/connection/ConnectionFactoryUtils.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -127,7 +127,6 @@ public static Connection doGetConnection(ConnectionFactory cf) throws ResourceEx
127127
Connection con = cf.getConnection();
128128

129129
if (TransactionSynchronizationManager.isSynchronizationActive()) {
130-
logger.debug("Registering transaction synchronization for CCI Connection");
131130
conHolder = new ConnectionHolder(con);
132131
conHolder.setSynchronizedWithTransaction(true);
133132
TransactionSynchronizationManager.registerSynchronization(new ConnectionSynchronization(conHolder, cf));

0 commit comments

Comments
 (0)