[CORDA-2807] Don't retry db transaction in AbstactNode start (#4942)

Retries can lead to confusing error messages in case the CFT notary is
misconfigured and throws a SQLException causing a retry.
This commit is contained in:
Thomas Schroeter
2019-03-29 09:41:39 +00:00
committed by josecoll
parent d9e11b21ae
commit dc46446432
2 changed files with 10 additions and 1 deletions

View File

@ -227,6 +227,15 @@ class CordaPersistence(
}
}
/**
* Executes given statement in the scope of transaction with the transaction level specified at the creation time.
* @param statement to be executed in the scope of this transaction.
* @param recoverableFailureTolerance number of transaction commit retries for SQL while SQL exception is encountered.
*/
fun <T> transaction(recoverableFailureTolerance: Int, statement: DatabaseTransaction.() -> T): T {
return transaction(defaultIsolationLevel, recoverableFailureTolerance, false, statement)
}
private fun <T> inTopLevelTransaction(isolationLevel: TransactionIsolationLevel, recoverableFailureTolerance: Int,
recoverAnyNestedSQLException: Boolean, statement: DatabaseTransaction.() -> T): T {
var recoverableFailureCount = 0