Skip to content
Snippets Groups Projects
Verified Commit d9edecb7 authored by Sebastian's avatar Sebastian
Browse files

Improve readability for unlocking of transactionLock

parent 3067d758
Branches
Tags
1 merge request!53Avoid deadlocks with dropAllTablesAndClose() and concurrently started transactions
......@@ -233,13 +233,12 @@ abstract class JdbcDatabase(private val dbTypes: DatabaseTypes, private val cloc
}
return try {
Transaction(startTransaction(), readOnly)
} catch (e: DbException) {
if (readOnly) transactionLock.readLock().unlock() else transactionLock.writeLock()
.unlock()
throw e
} catch (e: RuntimeException) {
if (readOnly) transactionLock.readLock().unlock() else transactionLock.writeLock()
.unlock()
} catch (e: Throwable) {
if (readOnly) {
transactionLock.readLock().unlock()
} else {
transactionLock.writeLock().unlock()
}
throw e
}
}
......@@ -646,8 +645,11 @@ abstract class JdbcDatabase(private val dbTypes: DatabaseTypes, private val cloc
abortTransaction(connection)
}
} finally {
if (txn.isReadOnly) transactionLock.readLock().unlock() else transactionLock.writeLock()
.unlock()
if (txn.isReadOnly) {
transactionLock.readLock().unlock()
} else {
transactionLock.writeLock().unlock()
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment