@FunctionalInterface public static interface TransactionRunner.TransactionCallable<T>
Modifier and Type | Method and Description |
---|---|
T |
run(TransactionContext transaction)
Invoked by the library framework to perform a single attempt of a transaction.
|
@Nullable T run(TransactionContext transaction) throws Exception
The framework will attempt to commit the transaction when this method returns normally. If
commit is successful, the return value from this method will be returned from TransactionRunner.run(TransactionCallable)
; on failure, the transaction may be retried by
the framework by calling the method again.
If this method raises an exception, one of two things can happen. If some operation in the
transaction has previously detected that the transaction has been aborted, the framework may
retry the transaction. Otherwise, the framework will roll back the transaction, releasing any
locks held, and yield the exception to the caller as a SpannerException
of type
ErrorCode.UNKNOWN
with the exception as the cause.
Exception
Copyright © 2022 Google LLC. All rights reserved.