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

Commit 7711420

Browse files
committed
cleanup: return instead of fallthrough + improve comment
Return the TransactionSelector that is built instead of falling through to the end of the method. The behavior does not change by this, but it makes it easier to read and understand the code. Fixes #830
1 parent 61ea2b9 commit 7711420

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

google-cloud-spanner/src/main/java/com/google/cloud/spanner/TransactionRunnerImpl.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,10 @@ TransactionSelector getTransactionSelector() {
463463
// Aborted error if the call that included the BeginTransaction option fails. The
464464
// Aborted error will cause the entire transaction to be retried, and the retry will use
465465
// a separate BeginTransaction RPC.
466-
TransactionSelector.newBuilder()
466+
// If tx.get() returns successfully, this.transactionId will also have been set to a
467+
// valid value as the latter is always set when a transaction id is returned by a
468+
// statement.
469+
return TransactionSelector.newBuilder()
467470
.setId(tx.get(waitForTransactionTimeoutMillis, TimeUnit.MILLISECONDS))
468471
.build();
469472
}

0 commit comments

Comments
 (0)