# ThreadLocalTransactionManager

class ThreadLocalTransactionManager(db: Database, setupTxConnection: (ExposedConnection<*>, TransactionInterface) -> Unit? = null) : TransactionManager

TransactionManager implementation registered to the provided database value db.

setupTxConnection can be provided to override the default configuration of transaction settings when a connection is retrieved from the database.

## Constructors

ThreadLocalTransactionManager
Link copied to clipboard
constructor(db: Database, setupTxConnection: (ExposedConnection<*>, TransactionInterface) -> Unit? = null)

## Properties

defaultIsolationLevel
Link copied to clipboard
@Volatile
@set:TestOnly
open override var defaultIsolationLevel: Int

The default transaction isolation level. Unless specified, the database-specific level will be used.

defaultMaxAttempts
Link copied to clipboard
@Volatile
open override var defaultMaxAttempts: Int

The default maximum amount of attempts that will be made to perform a transaction.

defaultMaxRepetitionDelay
Link copied to clipboard
open override var defaultMaxRepetitionDelay: Long
defaultMaxRetryDelay
Link copied to clipboard
@Volatile
open override var defaultMaxRetryDelay: Long

The default maximum number of milliseconds to wait before retrying a transaction if an exception is thrown.

defaultMinRepetitionDelay
Link copied to clipboard
open override var defaultMinRepetitionDelay: Long
defaultMinRetryDelay
Link copied to clipboard
@Volatile
open override var defaultMinRetryDelay: Long

The default minimum number of milliseconds to wait before retrying a transaction if an exception is thrown.

defaultReadOnly
Link copied to clipboard
@Volatile
open override var defaultReadOnly: Boolean

Whether transactions should be performed in read-only mode. Unless specified, the database default will be used.

defaultRepetitionAttempts
Link copied to clipboard
open override var defaultRepetitionAttempts: Int
threadLocal
Link copied to clipboard
val threadLocal: ThreadLocal<Transaction>

A thread local variable storing the current transaction.

## Functions

bindTransactionToThread
Link copied to clipboard
open override fun bindTransactionToThread(transaction: Transaction?)

Sets the current thread's copy of the manager's thread-local variable to the specified transaction.

currentOrNull
Link copied to clipboard
open override fun currentOrNull(): Transaction?

Returns the current Transaction, or `null` if none exists.

newTransaction
Link copied to clipboard
open override fun newTransaction(isolation: Int, readOnly: Boolean, outerTransaction: Transaction?): Transaction

Returns a Transaction instance.

toString
Link copied to clipboard
open override fun toString(): String