net.corda.node.utilities / StrandLocalTransactionManager

# StrandLocalTransactionManager

`class StrandLocalTransactionManager`

A relatively close copy of the ThreadLocalTransactionManager in Exposed but with the following adjustments to suit our environment:

Because the construction of a Database instance results in replacing the singleton TransactionManager instance, our tests involving two MockNodes effectively replace the database instances of each other and continue to trample over each other. So here we use a companion object to hold them as ThreadLocal and StrandLocalTransactionManager is otherwise effectively stateless so its replacement does not matter. The ThreadLocal is then set correctly and explicitly just prior to initiating a transaction in databaseTransaction and createDatabaseTransaction above.

### Constructors

<init> | `StrandLocalTransactionManager(initWithDatabase: <ERROR CLASS>)` A relatively close copy of the ThreadLocalTransactionManager in Exposed but with the following adjustments to suit our environment:

### Functions

currentOrNull | `fun currentOrNull(): <ERROR CLASS>?`
newTransaction | `fun newTransaction(isolation: Int): <ERROR CLASS>`

### Companion Object Properties

database | `var database: <ERROR CLASS>`

### Companion Object Functions

restoreThreadLocalTx | `fun restoreThreadLocalTx(context: <ERROR CLASS><<ERROR CLASS>?, <ERROR CLASS>?>): Unit`
setThreadLocalTx | `fun setThreadLocalTx(tx: <ERROR CLASS>?): <ERROR CLASS><<ERROR CLASS>?, <ERROR CLASS>?>`