Skip to content

Commit f7e3177

Browse files
committed
very minor code changes
1 parent 05cf85b commit f7e3177

File tree

1 file changed

+26
-29
lines changed

1 file changed

+26
-29
lines changed

hibernate-core/src/main/java/org/hibernate/internal/AbstractSharedSessionContract.java

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -461,37 +461,35 @@ public boolean isClosed() {
461461

462462
@Override
463463
public void close() {
464-
if ( closed && !waitingForAutoClose ) {
465-
return;
466-
}
467-
468-
try {
469-
delayedAfterCompletion();
470-
}
471-
catch ( HibernateException e ) {
472-
if ( getFactory().getSessionFactoryOptions().isJpaBootstrap() ) {
473-
throw getExceptionConverter().convert( e );
464+
if ( !closed || waitingForAutoClose ) {
465+
try {
466+
delayedAfterCompletion();
474467
}
475-
else {
476-
throw e;
468+
catch ( HibernateException e ) {
469+
if ( getFactory().getSessionFactoryOptions().isJpaBootstrap() ) {
470+
throw getExceptionConverter().convert( e );
471+
}
472+
else {
473+
throw e;
474+
}
477475
}
478-
}
479476

480-
if ( sessionEventsManager != null ) {
481-
sessionEventsManager.end();
482-
}
477+
if ( sessionEventsManager != null ) {
478+
sessionEventsManager.end();
479+
}
483480

484-
if ( transactionCoordinator != null ) {
485-
removeSharedSessionTransactionObserver( transactionCoordinator );
486-
}
481+
if ( transactionCoordinator != null ) {
482+
removeSharedSessionTransactionObserver( transactionCoordinator );
483+
}
487484

488-
try {
489-
if ( shouldCloseJdbcCoordinatorOnClose( isTransactionCoordinatorShared ) ) {
490-
jdbcCoordinator.close();
485+
try {
486+
if ( shouldCloseJdbcCoordinatorOnClose( isTransactionCoordinatorShared ) ) {
487+
jdbcCoordinator.close();
488+
}
489+
}
490+
finally {
491+
setClosed();
491492
}
492-
}
493-
finally {
494-
setClosed();
495493
}
496494
}
497495

@@ -553,10 +551,9 @@ public void markForRollbackOnly() {
553551

554552
@Override
555553
public boolean isTransactionInProgress() {
556-
if ( waitingForAutoClose ) {
557-
return factory.isOpen() && transactionCoordinator.isTransactionActive();
558-
}
559-
return !isClosed() && transactionCoordinator.isTransactionActive();
554+
return waitingForAutoClose
555+
? factory.isOpen() && transactionCoordinator.isTransactionActive()
556+
: !isClosed() && transactionCoordinator.isTransactionActive();
560557
}
561558

562559
@Override

0 commit comments

Comments
 (0)