Package com.mongodb
Class TransactionOptions
java.lang.Object
com.mongodb.TransactionOptions
Options to apply to transactions. The default values for the options depend on context. For options specified per-transaction, the
default values come from the default transaction options. For the default transaction options themselves, the default values come from
the MongoClient on which the session was started.
- Since:
- 3.8
- See Also:
- Since server release
- 4.0
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
The builder for transaction options -
Method Summary
Modifier and TypeMethodDescriptionstatic TransactionOptions.Builder
builder()
Gets an instance of a builderboolean
getMaxCommitTime
(TimeUnit timeUnit) Gets the maximum amount of time to allow a single commitTransaction command to execute.Gets the read concern.Gets the read preference.Gets the write concern.int
hashCode()
static TransactionOptions
merge
(TransactionOptions options, TransactionOptions defaultOptions) Merge the two provided transaction options, with the first taking precedence over the second.toString()
-
Method Details
-
getReadConcern
Gets the read concern.- Returns:
- the read concern
-
getWriteConcern
Gets the write concern.- Returns:
- the write concern
-
getReadPreference
Gets the read preference.- Returns:
- the write concern
-
getMaxCommitTime
Gets the maximum amount of time to allow a single commitTransaction command to execute. The default is null, which places no limit on the execution time.- Parameters:
timeUnit
- the time unit to return the result in- Returns:
- the maximum execution time in the given time unit
- Since:
- 3.11
- Since server release
- 4.2
-
builder
Gets an instance of a builder- Returns:
- a builder instance
-
merge
public static TransactionOptions merge(TransactionOptions options, TransactionOptions defaultOptions) Merge the two provided transaction options, with the first taking precedence over the second.- Parameters:
options
- the transaction options, which take precedence for any property that is non-nulldefaultOptions
- the default transaction options- Returns:
- the merged transaction options
-
equals
-
hashCode
public int hashCode() -
toString
-