HHH-8942 reduced logging hits in TransactionCoordinatorImpl

Conflicts:
	hibernate-core/src/main/java/org/hibernate/engine/transaction/internal/TransactionCoordinatorImpl.java
This commit is contained in:
Brett Meyer 2014-02-06 14:07:08 -05:00
parent 5a0a5025e7
commit f7c7842cc4
1 changed files with 7 additions and 5 deletions

View File

@ -64,6 +64,8 @@ import org.hibernate.service.jta.platform.spi.JtaPlatform;
public class TransactionCoordinatorImpl implements TransactionCoordinator {
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, TransactionCoordinatorImpl.class.getName());
private static final boolean DEBUGGING = LOG.isDebugEnabled();
private static final boolean TRACING = LOG.isTraceEnabled();
private final transient TransactionContext transactionContext;
private final transient JdbcCoordinatorImpl jdbcCoordinator;
@ -134,7 +136,7 @@ public class TransactionCoordinatorImpl implements TransactionCoordinator {
}
public void afterTransaction(TransactionImplementor hibernateTransaction, int status) {
LOG.trace( "after transaction completion" );
if (TRACING) LOG.trace( "after transaction completion" );
final boolean success = JtaStatusHelper.isCommitted( status );
@ -221,7 +223,7 @@ public class TransactionCoordinatorImpl implements TransactionCoordinator {
if ( ! transactionContext.shouldAutoJoinTransaction() ) {
if ( currentHibernateTransaction.getJoinStatus() != JoinStatus.MARKED_FOR_JOINED ) {
LOG.debug( "Skipping JTA sync registration due to auto join checking" );
if (DEBUGGING) LOG.debug( "Skipping JTA sync registration due to auto join checking" );
return;
}
}
@ -239,19 +241,19 @@ public class TransactionCoordinatorImpl implements TransactionCoordinator {
// Can we resister a synchronization
if ( !jtaPlatform.canRegisterSynchronization() ) {
LOG.trace( "registered JTA platform says we cannot currently resister synchronization; skipping" );
if (TRACING) LOG.trace( "registered JTA platform says we cannot currently resister synchronization; skipping" );
return;
}
// Should we resister a synchronization
if ( ! transactionFactory().isJoinableJtaTransaction( this, currentHibernateTransaction ) ) {
LOG.trace( "TransactionFactory reported no JTA transaction to join; skipping Synchronization registration" );
if (TRACING) LOG.trace( "TransactionFactory reported no JTA transaction to join; skipping Synchronization registration" );
return;
}
jtaPlatform.registerSynchronization( new RegisteredSynchronization( getSynchronizationCallbackCoordinator() ) );
synchronizationRegistered = true;
LOG.debug( "successfully registered Synchronization" );
if (DEBUGGING) LOG.debug( "successfully registered Synchronization" );
}
@Override