HHH-10358 Make sure synchronization on AbstractLoadPlanBasedLoader is skipped when the guarded feature is disabled
This commit is contained in:
parent
0a332c2e8d
commit
c1cb413c2a
|
@ -25,6 +25,7 @@ import org.hibernate.dialect.pagination.LimitHelper;
|
|||
import org.hibernate.dialect.pagination.NoopLimitHandler;
|
||||
import org.hibernate.engine.jdbc.ColumnNameCache;
|
||||
import org.hibernate.engine.jdbc.spi.JdbcServices;
|
||||
import org.hibernate.engine.jdbc.spi.ResultSetWrapper;
|
||||
import org.hibernate.engine.spi.PersistenceContext;
|
||||
import org.hibernate.engine.spi.QueryParameters;
|
||||
import org.hibernate.engine.spi.RowSelection;
|
||||
|
@ -468,18 +469,22 @@ public abstract class AbstractLoadPlanBasedLoader {
|
|||
}
|
||||
}
|
||||
|
||||
private synchronized ResultSet wrapResultSetIfEnabled(final ResultSet rs, final SessionImplementor session) {
|
||||
// synchronized to avoid multi-thread access issues; defined as method synch to avoid
|
||||
// potential deadlock issues due to nature of code.
|
||||
private ResultSet wrapResultSetIfEnabled(final ResultSet rs, final SessionImplementor session) {
|
||||
if ( session.getFactory().getSessionFactoryOptions().isWrapResultSetsEnabled() ) {
|
||||
try {
|
||||
if ( log.isDebugEnabled() ) {
|
||||
log.debugf( "Wrapping result set [%s]", rs );
|
||||
}
|
||||
return session.getFactory()
|
||||
ResultSetWrapper wrapper = session.getFactory()
|
||||
.getServiceRegistry()
|
||||
.getService( JdbcServices.class )
|
||||
.getResultSetWrapper().wrap( rs, retreiveColumnNameToIndexCache( rs ) );
|
||||
.getResultSetWrapper();
|
||||
// synchronized to avoid multi-thread access issues
|
||||
// Apparently the comment about this needing synchronization was introduced when AbstractLoadPlanBasedLoader first appeared
|
||||
// in version control. Would need to investigate if it's still needed?
|
||||
synchronized ( this ) {
|
||||
return wrapper.wrap( rs, retreiveColumnNameToIndexCache( rs ) );
|
||||
}
|
||||
}
|
||||
catch(SQLException e) {
|
||||
log.unableToWrapResultSet( e );
|
||||
|
|
Loading…
Reference in New Issue