Class TransactionOptions.Builder

java.lang.Object
com.pyranid.TransactionOptions.Builder
Enclosing class:
TransactionOptions

@NotThreadSafe public static final class TransactionOptions.Builder extends Object
Builder used to construct TransactionOptions.

This class is intended for use by a single thread.

Since:
4.2.0
Author:
Mark Allen
  • Method Details

    • isolation

      Configures the transaction isolation level.
      Parameters:
      isolation - the desired database transaction isolation level
      Returns:
      this builder, for chaining
    • readOnly

      Configures the transaction read-only setting.

      true requests a read-only transaction, false requests a read-write transaction, and null leaves the connection's read-only state unchanged.

      Parameters:
      readOnly - read-only setting to apply
      Returns:
      this builder, for chaining
    • completionObserver

      Configures diagnostic observation of each transaction boundary, including every retry attempt.

      The observer runs synchronously after JDBC cleanup and all post-transaction hooks, before the transaction method returns or throws. Its failure is contained and does not change the transaction result or retry decisions. Use Transaction.addPostTransactionOperation(Consumer) for application hooks whose failures should propagate. Observers must be fast and thread-safe when these options are shared across threads. Argument validation failures before a transaction scope exists are not observed.

      Parameters:
      completionObserver - observer, or null to remove it
      Returns:
      this builder, for chaining
      Since:
      4.8.0
    • build

      Builds transaction options.
      Returns:
      transaction options