Skip to content
This repository was archived by the owner on Apr 7, 2026. It is now read-only.

fix: gracefully ignore RejectedExecutionException during Connection#close()#1887

Merged
olavloite merged 1 commit intomainfrom
handle-rejected-execution-exception
May 27, 2022
Merged

fix: gracefully ignore RejectedExecutionException during Connection#close()#1887
olavloite merged 1 commit intomainfrom
handle-rejected-execution-exception

Conversation

@olavloite
Copy link
Copy Markdown
Collaborator

Gracefully catch and ignore RejectedExecutionExceptions that might happen while closing a connection. This prevents the SpannerPool from holding on to connections that failed to close because of such an error.

@olavloite olavloite requested review from a team and rajatbhatta May 24, 2022 15:17
@product-auto-label product-auto-label bot added size: s Pull request size is small. api: spanner Issues related to the googleapis/java-spanner API. labels May 24, 2022
abortBatch();
}
if (isTransactionStarted()) {
synchronized (this) {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change looks bigger than it is. The actual change here is that:

  1. The block is placed inside a synchronized (this) block.
  2. The futures.add(statementExecutor.submit(() -> null)); line is placed inside a try-catch block.

Copy link
Copy Markdown
Contributor

@rajatbhatta rajatbhatta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Copy link
Copy Markdown
Contributor

@ansh0l ansh0l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@olavloite olavloite merged commit 091bd1d into main May 27, 2022
@olavloite olavloite deleted the handle-rejected-execution-exception branch May 27, 2022 15:03
gcf-merge-on-green bot pushed a commit that referenced this pull request May 31, 2022
🤖 I have created a release *beep* *boop*
---


## [6.25.5](v6.25.4...v6.25.5) (2022-05-31)


### Bug Fixes

* add configurations for Explain feature ([#1899](#1899)) ([86895b7](86895b7))
* gracefully ignore RejectedExecutionException during Connection#close() ([#1887](#1887)) ([091bd1d](091bd1d))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: spanner Issues related to the googleapis/java-spanner API. size: s Pull request size is small.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants