Fixed deadlock when Transactor is restarted in the middle of a transaction

This commit is contained in:
Jonas Bonér 2010-07-14 12:51:00 +02:00
parent 815c0ab967
commit 016c071f25
6 changed files with 82 additions and 63 deletions

View file

@ -149,7 +149,14 @@ class GlobalStm extends TransactionManagement with Logging {
def atomic[T](body: => T)(implicit factory: TransactionFactory = DefaultGlobalTransactionFactory): T = atomic(factory)(body)
def atomic[T](factory: TransactionFactory)(body: => T): T = {
factory.boilerplate.execute(new TransactionalCallable[T]() {
/* MultiverseStmUtils.scheduleDeferredTask(new Runnable {
def run = try {
getTransactionSetInScope.tryJoinCommit(getRequiredThreadLocalTransaction, TransactionConfig.TIMEOUT, TimeUnit.MILLISECONDS)
clearTransaction
} catch {
case e: IllegalStateException => {}
}})
*/ factory.boilerplate.execute(new TransactionalCallable[T]() {
def call(mtx: MultiverseTransaction): T = {
if (!isTransactionSetInScope) createNewTransactionSet
factory.addHooks
@ -159,7 +166,7 @@ class GlobalStm extends TransactionManagement with Logging {
mtx.commit
// Need to catch IllegalStateException until we have fix in Multiverse, since it throws it by mistake
try { txSet.tryJoinCommit(mtx, TransactionConfig.TIMEOUT, TimeUnit.MILLISECONDS) } catch { case e: IllegalStateException => {} }
clearTransaction
// try { txSet.joinCommit(mtx) } catch { case e: IllegalStateException => {} }
result
}
})