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 = 84, value = "The application requested a JDBC connection, but Hibernate Reactive doesn't use JDBC. This could be caused by a bug or the use of an unsupported feature in Hibernate Reactive")
SQLException notUsingJdbc();

@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 @@ -1700,7 +1700,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