Skip to content

Commit

Permalink
Add Transaction to lifecycle hooks for JetBrains#1530
Browse files Browse the repository at this point in the history
  • Loading branch information
rromanowski-figure committed Jun 13, 2022
1 parent b456bbe commit 320dbcb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,17 @@ open class Transaction(private val transactionImpl: TransactionInterface) : User
}
transactionImpl.commit()
userdata.clear()
globalInterceptors.forEach { it.afterCommit() }
interceptors.forEach { it.afterCommit() }
globalInterceptors.forEach { it.afterCommit(this) }
interceptors.forEach { it.afterCommit(this) }
userdata.putAll(dataToStore)
}

override fun rollback() {
globalInterceptors.forEach { it.beforeRollback(this) }
interceptors.forEach { it.beforeRollback(this) }
transactionImpl.rollback()
globalInterceptors.forEach { it.afterRollback() }
interceptors.forEach { it.afterRollback() }
globalInterceptors.forEach { it.afterRollback(this) }
interceptors.forEach { it.afterRollback(this) }
userdata.clear()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ interface StatementInterceptor {
fun afterExecution(transaction: Transaction, contexts: List<StatementContext>, executedStatement: PreparedStatementApi) {}

fun beforeCommit(transaction: Transaction) {}
fun afterCommit() {}
fun afterCommit(transaction: Transaction) {}

fun beforeRollback(transaction: Transaction) {}
fun afterRollback() {}
fun afterRollback(transaction: Transaction) {}

fun keepUserDataInTransactionStoreOnCommit(userData: Map<Key<*>, Any?>): Map<Key<*>, Any?> = emptyMap()
}
Expand Down

0 comments on commit 320dbcb

Please sign in to comment.