Author: elecharny
Date: Fri Aug 10 00:41:46 2012
New Revision: 1371538
URL: http://svn.apache.org/viewvc?rev=1371538&view=rev
Log:
o Made the rootPage volatile, so that no thread can use it while it's being
modified.
o Removed the useless commitTransaction() method
o Transaction class now takes a Page,not the whole btree.
Modified:
labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/BTree.java
Modified:
labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/BTree.java
URL:
http://svn.apache.org/viewvc/labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/BTree.java?rev=1371538&r1=1371537&r2=1371538&view=diff
==============================================================================
---
labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/BTree.java
(original)
+++
labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/BTree.java
Fri Aug 10 00:41:46 2012
@@ -62,7 +62,7 @@ public class BTree<K, V>
private Comparator<K> comparator;
/** The current rootPage */
- protected Page<K, V> rootPage;
+ protected volatile Page<K, V> rootPage;
/** A map containing all the existing revisions */
private Map<Long, Page<K, V>> roots = new ConcurrentHashMap<Long, Page<K,
V>>();
@@ -600,28 +600,18 @@ public class BTree<K, V>
/**
* Starts a Read Only transaction. If the transaction is not closed, it
will be
* automatically closed after the timeout
- * @return
+ * @return The created transaction
*/
public Transaction<K, V> beginReadTransaction()
{
- Transaction<K, V> readTransaction = new Transaction<K, V>( this,
revision.get() - 1, System.currentTimeMillis() );
+ Transaction<K, V> readTransaction = new Transaction<K, V>( rootPage,
revision.get() - 1,
+ System.currentTimeMillis() );
return readTransaction;
}
/**
- * Validate the transaction.
- *
- * @param transaction The transaction to commit
- */
- public void commitTransaction( Transaction<K, V> transaction )
- {
-
- }
-
-
- /**
* @return the comparator
*/
public Comparator<K> getComparator()
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]