Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,10 @@ public interface Log extends BasicLogger {
@Message(id = 85, value = "Reactive sessions do not support transparent lazy fetching - use Stage.fetch() or Mutiny.fetch() (property '%1$S' of entity '%2$s' was not loaded)")
LazyInitializationException lazyFieldInitializationException(String fieldName, String entityName);

@LogMessage(level = ERROR)
@Message(id = 86, value = "Error closing reactive connection")
void errorClosingConnection(@Cause Throwable throwable);

// Same method that exists in CoreMessageLogger
@LogMessage(level = WARN)
@Message(id = 104, value = "firstResult/maxResults specified with collection fetch; applying in memory!" )
Expand Down Expand Up @@ -328,5 +332,4 @@ public interface Log extends BasicLogger {
" This is probably due to an operation failing fast due to the transaction being marked for rollback.",
id = 520)
void jdbcExceptionThrownWithTransactionRolledBack(@Cause JDBCException e);

}
Original file line number Diff line number Diff line change
Expand Up @@ -1738,7 +1738,23 @@ public void close() throws HibernateException {

@Override
public CompletionStage<Void> reactiveClose() {
super.close();
try {
super.close();
return closeConnection();
}
catch (RuntimeException e) {
return closeConnection()
.handle( CompletionStages::handle )
.thenCompose( closeConnectionHandler -> {
if ( closeConnectionHandler.hasFailed() ) {
LOG.errorClosingConnection( closeConnectionHandler.getThrowable() );
}
return failedFuture( e );
} );
}
}

private CompletionStage<Void> closeConnection() {
return reactiveConnection != null
? reactiveConnection.close()
: voidFuture();
Expand Down
Loading