HHH-2604 : Isolator.JdbcDelegate connection releasing

git-svn-id: https://svn.jboss.org/repos/hibernate/core/branches/Branch_3_2@14999 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Steve Ebersole 2008-07-31 15:10:43 +00:00
parent 1d89a18d2d
commit 5e1a485f4e
2 changed files with 20 additions and 20 deletions

View File

@ -215,15 +215,17 @@ public class Isolater {
} }
} }
finally { finally {
if ( transacted && wasAutoCommit ) { if ( connection != null ) {
try { if ( transacted && wasAutoCommit ) {
connection.setAutoCommit( true ); try {
} connection.setAutoCommit( true );
catch( Throwable ignore ) { }
log.trace( "was unable to reset connection back to auto-commit" ); catch( Throwable ignore ) {
log.trace( "was unable to reset connection back to auto-commit" );
}
} }
session.getBatcher().closeConnection( connection );
} }
session.getBatcher().closeConnection( connection );
} }
} }
} }

View File

@ -590,26 +590,24 @@ public abstract class AbstractBatcher implements Batcher {
} }
public void closeConnection(Connection conn) throws HibernateException { public void closeConnection(Connection conn) throws HibernateException {
if ( conn == null ) {
log.debug( "found null connection on AbstractBatcher#closeConnection" );
// EARLY EXIT!!!!
return;
}
if ( log.isDebugEnabled() ) { if ( log.isDebugEnabled() ) {
log.debug( log.debug( "closing JDBC connection" + preparedStatementCountsToString() + resultSetCountsToString() );
"closing JDBC connection" +
preparedStatementCountsToString() +
resultSetCountsToString()
);
} }
try { try {
if ( !conn.isClosed() ) { if ( !conn.isClosed() ) {
JDBCExceptionReporter.logAndClearWarnings(conn); JDBCExceptionReporter.logAndClearWarnings( conn );
} }
factory.getConnectionProvider().closeConnection(conn); factory.getConnectionProvider().closeConnection( conn );
} }
catch (SQLException sqle) { catch ( SQLException sqle ) {
throw JDBCExceptionHelper.convert( throw JDBCExceptionHelper.convert( factory.getSQLExceptionConverter(), sqle, "Cannot close connection" );
factory.getSQLExceptionConverter(),
sqle,
"Cannot close connection"
);
} }
} }