Class TransactionOptions


  • public class TransactionOptions
    extends java.lang.Object
    • Constructor Detail

      • TransactionOptions

        public TransactionOptions()
      • TransactionOptions

        public TransactionOptions​(JsonObject json)
    • Method Detail

      • setReadConcern

        public TransactionOptions setReadConcern​(ReadConcern readConcern)
        Sets the read concern.
        Parameters:
        readConcern - the read concern
        Returns:
        this
      • getReadConcern

        public ReadConcern getReadConcern()
        Gets the read concern.
        Returns:
        the read concern
      • setWriteConcern

        public TransactionOptions setWriteConcern​(WriteConcern writeConcern)
        Sets the write concern.
        Parameters:
        writeConcern - the write concern, which must be acknowledged
        Returns:
        this
      • getWriteConcern

        public WriteConcern getWriteConcern()
        Gets the write concern.
        Returns:
        the write concern
      • setReadPreference

        public TransactionOptions setReadPreference​(ReadPreference readPreference)
        Sets the read preference.
        Parameters:
        readPreference - the read preference, which currently must be primary. This restriction may be relaxed in future versions.
        Returns:
        this
      • getReadPreference

        public ReadPreference getReadPreference()
        Gets the read preference.
        Returns:
        the write concern
      • setMaxCommitTime

        public TransactionOptions setMaxCommitTime​(java.lang.Long maxCommitTime)
        Sets the maximum execution time on the server for the commitTransaction operation.
        Parameters:
        maxCommitTime - the max commit time, which must be either null or greater than zero, in the given time unit (in milliseconds)
        Returns:
        this
        Since:
        3.11
        Since server release
        4.2
      • getMaxCommitTime

        public java.lang.Long 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.
        Returns:
        the maximum execution time (in milliseconds)
        Since:
        3.11
        Since server release
        4.2