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

outside for loop.

Conflicts:
	hibernate-core/src/main/java/org/hibernate/loader/Loader.java
This commit is contained in:
Jeremy Whiting 2013-04-11 17:54:29 -04:00 committed by Brett Meyer
parent ed9d7f2fa2
commit afeabdc7b0
1 changed files with 12 additions and 6 deletions

View File

@ -935,7 +935,9 @@ public abstract class Loader {
EntityKey[] keys = new EntityKey[entitySpan]; //we can reuse it for each row EntityKey[] keys = new EntityKey[entitySpan]; //we can reuse it for each row
LOG.trace( "Processing result set" ); LOG.trace( "Processing result set" );
int count; int count;
boolean isDebugEnabled = LOG.isDebugEnabled();
for ( count = 0; count < maxRows && rs.next(); count++ ) { for ( count = 0; count < maxRows && rs.next(); count++ ) {
if ( isDebugEnabled )
LOG.debugf( "Result set row: %s", count ); LOG.debugf( "Result set row: %s", count );
Object result = getRowFromResultSet( Object result = getRowFromResultSet(
rs, rs,
@ -955,6 +957,7 @@ public abstract class Loader {
} }
} }
if ( LOG.isTraceEnabled() )
LOG.tracev( "Done processing result set ({0} rows)", count ); LOG.tracev( "Done processing result set ({0} rows)", count );
initializeEntitiesAndCollections( initializeEntitiesAndCollections(
@ -1098,6 +1101,7 @@ public abstract class Loader {
if ( hydratedObjects!=null ) { if ( hydratedObjects!=null ) {
int hydratedObjectsSize = hydratedObjects.size(); int hydratedObjectsSize = hydratedObjects.size();
if ( LOG.isTraceEnabled() )
LOG.tracev( "Total objects hydrated: {0}", hydratedObjectsSize ); LOG.tracev( "Total objects hydrated: {0}", hydratedObjectsSize );
for ( int i = 0; i < hydratedObjectsSize; i++ ) { for ( int i = 0; i < hydratedObjectsSize; i++ ) {
TwoPhaseLoad.initializeEntity( hydratedObjects.get(i), readOnly, session, pre, post ); TwoPhaseLoad.initializeEntity( hydratedObjects.get(i), readOnly, session, pre, post );
@ -1900,6 +1904,7 @@ public abstract class Loader {
} }
} }
if ( LOG.isTraceEnabled() )
LOG.tracev( "Bound [{0}] parameters total", col ); LOG.tracev( "Bound [{0}] parameters total", col );
} }
catch ( SQLException sqle ) { catch ( SQLException sqle ) {
@ -2056,6 +2061,7 @@ public abstract class Loader {
// potential deadlock issues due to nature of code. // potential deadlock issues due to nature of code.
if ( session.getFactory().getSettings().isWrapResultSetsEnabled() ) { if ( session.getFactory().getSettings().isWrapResultSetsEnabled() ) {
try { try {
if ( LOG.isDebugEnabled() )
LOG.debugf( "Wrapping result set [%s]", rs ); LOG.debugf( "Wrapping result set [%s]", rs );
return session.getFactory() return session.getFactory()
.getJdbcServices() .getJdbcServices()