HHH-10358 Make sure synchronization on AbstractLoadPlanBasedLoader is skipped when the guarded feature is disabled
This commit is contained in:
parent
971783607e
commit
90ac42fa2c
|
@ -25,6 +25,7 @@ import org.hibernate.dialect.pagination.LimitHelper;
|
||||||
import org.hibernate.dialect.pagination.NoopLimitHandler;
|
import org.hibernate.dialect.pagination.NoopLimitHandler;
|
||||||
import org.hibernate.engine.jdbc.ColumnNameCache;
|
import org.hibernate.engine.jdbc.ColumnNameCache;
|
||||||
import org.hibernate.engine.jdbc.spi.JdbcServices;
|
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.PersistenceContext;
|
||||||
import org.hibernate.engine.spi.QueryParameters;
|
import org.hibernate.engine.spi.QueryParameters;
|
||||||
import org.hibernate.engine.spi.RowSelection;
|
import org.hibernate.engine.spi.RowSelection;
|
||||||
|
@ -468,18 +469,22 @@ public abstract class AbstractLoadPlanBasedLoader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized ResultSet wrapResultSetIfEnabled(final ResultSet rs, final SessionImplementor session) {
|
private 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.
|
|
||||||
if ( session.getFactory().getSessionFactoryOptions().isWrapResultSetsEnabled() ) {
|
if ( session.getFactory().getSessionFactoryOptions().isWrapResultSetsEnabled() ) {
|
||||||
try {
|
try {
|
||||||
if ( log.isDebugEnabled() ) {
|
if ( log.isDebugEnabled() ) {
|
||||||
log.debugf( "Wrapping result set [%s]", rs );
|
log.debugf( "Wrapping result set [%s]", rs );
|
||||||
}
|
}
|
||||||
return session.getFactory()
|
ResultSetWrapper wrapper = session.getFactory()
|
||||||
.getServiceRegistry()
|
.getServiceRegistry()
|
||||||
.getService( JdbcServices.class )
|
.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) {
|
catch(SQLException e) {
|
||||||
log.unableToWrapResultSet( e );
|
log.unableToWrapResultSet( e );
|
||||||
|
|
Loading…
Reference in New Issue