Skip to content

Commit

Permalink
Cleanup resources when commit is aborted (#251)
Browse files Browse the repository at this point in the history
Follow-up to #250.
  • Loading branch information
meltsufin authored Feb 2, 2021
1 parent 110b5c5 commit c4d5fe6
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,12 @@ protected void doCommit(DefaultTransactionStatus defaultTransactionStatus)
}
}
catch (AbortedException ex) {
// The client library will not close transaction resources if state == ABORTED
// to allow for retries, but we do not retry aborted transactions.
// See: SessionPool.close()
if (tx.getTransactionManager() != null) {
tx.getTransactionManager().close();
}
throw new UnexpectedRollbackException("Transaction Got Rolled Back", ex);
}
catch (SpannerException ex) {
Expand Down

0 comments on commit c4d5fe6

Please sign in to comment.