Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
May 27, 2022

Conversation

olavloite
Copy link
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 a review from rajatbhatta May 24, 2022 15:17
@olavloite olavloite requested a review from a team as a code owner 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
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
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
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 join this conversation on GitHub. Already have an account? Sign in to comment
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