Package com.mongodb
Class TransactionOptions
- java.lang.Object
-
- com.mongodb.TransactionOptions
-
@Immutable public final class TransactionOptions extends Object
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:
ClientSession,ClientSessionOptions- Since server release
- 4.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTransactionOptions.BuilderThe builder for transaction options
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static TransactionOptions.Builderbuilder()Gets an instance of a builderbooleanequals(Object o)ReadConcerngetReadConcern()Gets the read concern.ReadPreferencegetReadPreference()Gets the read preference.WriteConcerngetWriteConcern()Gets the write concern.inthashCode()static TransactionOptionsmerge(TransactionOptions options, TransactionOptions defaultOptions)Merge the two provided transaction options, with the first taking precedence over the second.StringtoString()
-
-
-
Method Detail
-
getReadConcern
@Nullable public ReadConcern getReadConcern()
Gets the read concern.- Returns:
- the read concern
-
getWriteConcern
@Nullable public WriteConcern getWriteConcern()
Gets the write concern.- Returns:
- the write concern
-
getReadPreference
@Nullable public ReadPreference getReadPreference()
Gets the read preference.- Returns:
- the write concern
-
builder
public static TransactionOptions.Builder 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
-
-