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(spanner): release resources in TransactionManager #3638

Merged
Merged
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 @@ -80,6 +80,13 @@ public void commit() {
} catch (SpannerException e2) {
txnState = TransactionState.COMMIT_FAILED;
throw e2;
} finally {
// At this point, if the TransactionState is not ABORTED, then the transaction has reached an
// end state.
// We can safely call close() to release resources.
if (getState() != TransactionState.ABORTED) {
close();
}
}
}

Expand All @@ -92,6 +99,9 @@ public void rollback() {
txn.rollback();
} finally {
txnState = TransactionState.ROLLED_BACK;
// At this point, the TransactionState is ROLLED_BACK which is an end state.
// We can safely call close() to release resources.
close();
}
}

Expand Down
Loading