[CORDA-1341]: Ensure API can be called concurrently wrt transactions. (#3235)

This commit is contained in:
Michele Sollecito
2018-05-29 15:25:34 +01:00
committed by GitHub
parent 0f82e2df7f
commit f68cf6f712
47 changed files with 852 additions and 849 deletions

View File

@ -42,7 +42,7 @@ enum class TransactionIsolationLevel {
val jdbcValue: Int = java.sql.Connection::class.java.getField("TRANSACTION_$name").get(null) as Int
}
private val _contextDatabase = ThreadLocal<CordaPersistence>()
private val _contextDatabase = InheritableThreadLocal<CordaPersistence>()
var contextDatabase: CordaPersistence
get() = _contextDatabase.get() ?: error("Was expecting to find CordaPersistence set on current thread: ${Strand.currentStrand()}")
set(database) = _contextDatabase.set(database)