Package com.google.cloud.firestore
Class TransactionOptions.ReadWriteOptionsBuilder
java.lang.Object
com.google.cloud.firestore.TransactionOptions.Builder<TransactionOptions.ReadWriteOptionsBuilder>
com.google.cloud.firestore.TransactionOptions.ReadWriteOptionsBuilder
- Enclosing class:
- TransactionOptions
public static final class TransactionOptions.ReadWriteOptionsBuilder
extends TransactionOptions.Builder<TransactionOptions.ReadWriteOptionsBuilder>
A typesafe builder class representing those options that are applicable when configuring a
transaction to be read-write. All methods function as "set" rather than returning a new copy
with a value set on it. By default, a read-write transaction will be attempted a max of 5
times.
-
Field Summary
Fields inherited from class com.google.cloud.firestore.TransactionOptions.Builder
executor -
Method Summary
Modifier and TypeMethodDescriptionbuild()intSpecify the max number of attempts a transaction will be attempted before resulting in an error.setNumberOfAttempts(int numberOfAttempts) Specify the max number of attempts a transaction will be attempted before resulting in an error.Methods inherited from class com.google.cloud.firestore.TransactionOptions.Builder
getExecutor, setExecutor
-
Method Details
-
getNumberOfAttempts
public int getNumberOfAttempts()Specify the max number of attempts a transaction will be attempted before resulting in an error.- Returns:
- The max number of attempts to try and commit the transaction.
-
setNumberOfAttempts
@Nonnull public TransactionOptions.ReadWriteOptionsBuilder setNumberOfAttempts(int numberOfAttempts) Specify the max number of attempts a transaction will be attempted before resulting in an error.- Parameters:
numberOfAttempts- The max number of attempts to try and commit the transaction.- Returns:
thisbuilder- Throws:
IllegalArgumentException- if numberOfAttempts is less than or equal to 0
-
build
- Specified by:
buildin classTransactionOptions.Builder<TransactionOptions.ReadWriteOptionsBuilder>- Returns:
- an instance of
TransactionOptionsfrom the values passed to this builder
-