public static interface AsyncRunner.AsyncWork<R>
Modifier and Type | Method and Description |
---|---|
com.google.api.core.ApiFuture<R> |
doWorkAsync(TransactionContext txn)
Performs a single transaction attempt.
|
com.google.api.core.ApiFuture<R> doWorkAsync(TransactionContext txn)
txn
.
Implementations of this method should not attempt to commit the transaction directly: returning normally will result in the runner attempting to commit the transaction once the returned future completes, retrying on abort.
In most cases, the implementation will not need to catch SpannerException
s from
Spanner operations, instead letting these propagate to the framework. The transaction runner
will take appropriate action based on the type of exception. In particular, implementations
should never catch an exception of type SpannerErrors#isAborted
: these indicate that
some reads may have returned inconsistent data and the transaction attempt must be aborted.
txn
- the transactionCopyright © 2020 Google LLC. All rights reserved.