From 32be9f78559deb7725818151a3e0735dde48b2d9 Mon Sep 17 00:00:00 2001 From: navid Date: Wed, 4 Feb 2009 04:44:17 +0000 Subject: [PATCH] *** empty log message *** --- Robust/Transactions/dstm2/src/dstm2/SpecialLock.java | 2 +- .../dstm2/src/dstm2/SpecialTransactionalFile.java | 7 ++++++- Robust/Transactions/dstm2/src/dstm2/Thread.java | 8 ++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Robust/Transactions/dstm2/src/dstm2/SpecialLock.java b/Robust/Transactions/dstm2/src/dstm2/SpecialLock.java index 33841af3..db872b19 100644 --- a/Robust/Transactions/dstm2/src/dstm2/SpecialLock.java +++ b/Robust/Transactions/dstm2/src/dstm2/SpecialLock.java @@ -22,7 +22,7 @@ public class SpecialLock extends ReentrantLock{ public synchronized void lock(Transaction tr){ super.lock(); - setOwnerTransaction(ownerTransaction); + setOwnerTransaction(tr); } public synchronized void unlock(Transaction tr){ diff --git a/Robust/Transactions/dstm2/src/dstm2/SpecialTransactionalFile.java b/Robust/Transactions/dstm2/src/dstm2/SpecialTransactionalFile.java index 68e53da8..2a3e44bc 100644 --- a/Robust/Transactions/dstm2/src/dstm2/SpecialTransactionalFile.java +++ b/Robust/Transactions/dstm2/src/dstm2/SpecialTransactionalFile.java @@ -30,12 +30,17 @@ public class SpecialTransactionalFile{ private void checkConsisteny(){ + // System.out.println(Thread.currentThread()); Transaction me = Thread.getTransaction(); if (!me.isActive()) { + SpecialLock.getSpecialLock().unlock(me); throw new AbortedException(); } - if (me != SpecialLock.getSpecialLock().getOwnerTransaction()) + if (me != SpecialLock.getSpecialLock().getOwnerTransaction()){ + // System.out.println("trying to lock " + Thread.currentThread()); SpecialLock.getSpecialLock().lock(me); + // System.out.println("locked " + Thread.currentThread()); + } if (!me.isActive()) { SpecialLock.getSpecialLock().unlock(me); diff --git a/Robust/Transactions/dstm2/src/dstm2/Thread.java b/Robust/Transactions/dstm2/src/dstm2/Thread.java index 00bb5569..f7da48d3 100644 --- a/Robust/Transactions/dstm2/src/dstm2/Thread.java +++ b/Robust/Transactions/dstm2/src/dstm2/Thread.java @@ -296,10 +296,14 @@ public class Thread extends java.lang.Thread{ } finally{ - + // System.out.println("here " + Thread.currentThread()); Wrapper.getTransaction().unlockAllLocks(); - if (Thread.getTransaction() == SpecialLock.getSpecialLock().getOwnerTransaction()) + if (Thread.getTransaction() == SpecialLock.getSpecialLock().getOwnerTransaction()){ + // System.out.println("herein " + Thread.currentThread()); SpecialLock.getSpecialLock().unlock(Thread.getTransaction()); + // System.out.println("here"); + + } if (flag == true) break; } -- 2.34.1