HHH-8180 Checks for logging level. Logging level check moved to variable

outside for loop.
This commit is contained in:
Jeremy Whiting 2013-04-11 17:52:20 -04:00 committed by Brett Meyer
parent bd315f01a9
commit 7778aae3b7
1 changed files with 11 additions and 5 deletions

View File

@ -931,8 +931,10 @@ public abstract class Loader {
EntityKey[] keys = new EntityKey[entitySpan]; //we can reuse it for each row
LOG.trace( "Processing result set" );
int count;
boolean isDebugEnabled = LOG.isDebugEnabled();
for ( count = 0; count < maxRows && rs.next(); count++ ) {
LOG.debugf( "Result set row: %s", count );
if ( isDebugEnabled )
LOG.debugf( "Result set row: %s", count );
Object result = getRowFromResultSet(
rs,
session,
@ -951,7 +953,8 @@ public abstract class Loader {
}
}
LOG.tracev( "Done processing result set ({0} rows)", count );
if ( LOG.isTraceEnabled() )
LOG.tracev( "Done processing result set ({0} rows)", count );
initializeEntitiesAndCollections(
hydratedObjects,
@ -1093,7 +1096,8 @@ public abstract class Loader {
if ( hydratedObjects!=null ) {
int hydratedObjectsSize = hydratedObjects.size();
LOG.tracev( "Total objects hydrated: {0}", hydratedObjectsSize );
if ( LOG.isTraceEnabled() )
LOG.tracev( "Total objects hydrated: {0}", hydratedObjectsSize );
for ( int i = 0; i < hydratedObjectsSize; i++ ) {
TwoPhaseLoad.initializeEntity( hydratedObjects.get(i), readOnly, session, pre, post );
}
@ -1901,7 +1905,8 @@ public abstract class Loader {
}
}
LOG.tracev( "Bound [{0}] parameters total", col );
if ( LOG.isTraceEnabled() )
LOG.tracev( "Bound [{0}] parameters total", col );
}
catch ( SQLException sqle ) {
session.getTransactionCoordinator().getJdbcCoordinator().release( st );
@ -2057,7 +2062,8 @@ public abstract class Loader {
// potential deadlock issues due to nature of code.
if ( session.getFactory().getSettings().isWrapResultSetsEnabled() ) {
try {
LOG.debugf( "Wrapping result set [%s]", rs );
if ( LOG.isDebugEnabled() )
LOG.debugf( "Wrapping result set [%s]", rs );
return session.getFactory()
.getJdbcServices()
.getResultSetWrapper().wrap( rs, retreiveColumnNameToIndexCache( rs ) );