very minor code changes

This commit is contained in:
Gavin King 2024-12-16 10:15:14 +01:00
parent 05cf85b61a
commit f7e3177dba
1 changed files with 28 additions and 31 deletions

View File

@ -461,37 +461,35 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
@Override @Override
public void close() { public void close() {
if ( closed && !waitingForAutoClose ) { if ( !closed || waitingForAutoClose ) {
return; try {
} delayedAfterCompletion();
try {
delayedAfterCompletion();
}
catch ( HibernateException e ) {
if ( getFactory().getSessionFactoryOptions().isJpaBootstrap() ) {
throw getExceptionConverter().convert( e );
} }
else { catch ( HibernateException e ) {
throw e; if ( getFactory().getSessionFactoryOptions().isJpaBootstrap() ) {
throw getExceptionConverter().convert( e );
}
else {
throw e;
}
} }
}
if ( sessionEventsManager != null ) { if ( sessionEventsManager != null ) {
sessionEventsManager.end(); sessionEventsManager.end();
} }
if ( transactionCoordinator != null ) { if ( transactionCoordinator != null ) {
removeSharedSessionTransactionObserver( transactionCoordinator ); removeSharedSessionTransactionObserver( transactionCoordinator );
} }
try { try {
if ( shouldCloseJdbcCoordinatorOnClose( isTransactionCoordinatorShared ) ) { if ( shouldCloseJdbcCoordinatorOnClose( isTransactionCoordinatorShared ) ) {
jdbcCoordinator.close(); jdbcCoordinator.close();
}
}
finally {
setClosed();
} }
}
finally {
setClosed();
} }
} }
@ -553,10 +551,9 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
@Override @Override
public boolean isTransactionInProgress() { public boolean isTransactionInProgress() {
if ( waitingForAutoClose ) { return waitingForAutoClose
return factory.isOpen() && transactionCoordinator.isTransactionActive(); ? factory.isOpen() && transactionCoordinator.isTransactionActive()
} : !isClosed() && transactionCoordinator.isTransactionActive();
return !isClosed() && transactionCoordinator.isTransactionActive();
} }
@Override @Override