Author: elecharny
Date: Mon Aug 13 13:54:24 2012
New Revision: 1372424

URL: http://svn.apache.org/viewvc?rev=1372424&view=rev
Log:
o Added a flag to tell that the transaction is closed
o Renamed a variable

Modified:
    
labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/Transaction.java

Modified: 
labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/Transaction.java
URL: 
http://svn.apache.org/viewvc/labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/Transaction.java?rev=1372424&r1=1372423&r2=1372424&view=diff
==============================================================================
--- 
labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/Transaction.java
 (original)
+++ 
labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/Transaction.java
 Mon Aug 13 13:54:24 2012
@@ -50,24 +50,30 @@ public class Transaction<K, V>
     private long creationDate;
 
     /** The revision on which we are having a transaction */
-    private Page<K, V> page;
+    private volatile Page<K, V> root;
+
+    /** A flag used to tell if a transaction is closed ot not */
+    private volatile boolean closed;
 
 
     /**
      * Creates a new transaction instance
+     * 
+     * @param root The associated root
      * @param revision The revision this transaction is using
      * @param creationDate The creation date for this transaction
      */
-    public Transaction( Page<K, V> page, long revision, long creationDate )
+    public Transaction( Page<K, V> root, long revision, long creationDate )
     {
         this.revision = revision;
         this.creationDate = creationDate;
-        this.page = page;
+        this.root = root;
+        closed = false;
     }
 
 
     /**
-     * @return the revision
+     * @return the associated revision
      */
     public long getRevision()
     {
@@ -76,6 +82,15 @@ public class Transaction<K, V>
 
 
     /**
+     * @return the associated root
+     */
+    public Page<K, V> getRoot()
+    {
+        return root;
+    }
+
+
+    /**
      * @return the creationDate
      */
     public long getCreationDate()
@@ -89,7 +104,17 @@ public class Transaction<K, V>
      */
     public void close()
     {
-        page = null;
+        root = null;
+        closed = true;
+    }
+
+
+    /**
+     * @return true if this transaction has been closed
+     */
+    public boolean isClosed()
+    {
+        return closed;
     }
 
 
@@ -98,6 +123,6 @@ public class Transaction<K, V>
      */
     public String toString()
     {
-        return "Transaction[" + revision + ":" + new Date( creationDate ) + 
"]";
+        return "Transaction[" + revision + ":" + new Date( creationDate ) + ", 
closed :" + closed + "]";
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to