*** empty log message ***
authornavid <navid>
Wed, 4 Feb 2009 04:44:17 +0000 (04:44 +0000)
committernavid <navid>
Wed, 4 Feb 2009 04:44:17 +0000 (04:44 +0000)
Robust/Transactions/dstm2/src/dstm2/SpecialLock.java
Robust/Transactions/dstm2/src/dstm2/SpecialTransactionalFile.java
Robust/Transactions/dstm2/src/dstm2/Thread.java

index 33841af3a9afd3b8171113b359f19bfaa0a04ed2..db872b19866eb94cc422d5531d4e07109bb922b9 100644 (file)
@@ -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){
index 68e53da8de173a381ca6af8687d55b3243140acd..2a3e44bc42cd6d6e2387d774d79ab86c5141728d 100644 (file)
@@ -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);
index 00bb5569cf7dc731abe09c02c95876f6b58f05fa..f7da48d3b608dcbccfa165b99ff424d1e21a3e63 100644 (file)
@@ -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;
         }