Fixed the bad try-with-resource usage in transaction: you can't abort in
the catch part as the txn has already been closed...
diff --git a/mavibot/src/main/java/org/apache/directory/mavibot/btree/MavibotInspector.java b/mavibot/src/main/java/org/apache/directory/mavibot/btree/MavibotInspector.java
index b5e1b1b..f69cab4 100644
--- a/mavibot/src/main/java/org/apache/directory/mavibot/btree/MavibotInspector.java
+++ b/mavibot/src/main/java/org/apache/directory/mavibot/btree/MavibotInspector.java
@@ -203,9 +203,12 @@
 
         System.out.print( "BTree Name: " );
         String name = readLine();
+        
+        Transaction transaction = null;
 
-        try ( Transaction transaction = rm.beginReadTransaction() )
+        try
         {
+            transaction = rm.beginReadTransaction();
             BTree<?, ?> pb = ( BTree<?, ?> ) rm.getBtree( transaction, name, Long.MAX_VALUE - 1 );
     
             if ( pb == null )
@@ -223,6 +226,15 @@
             System.out.println( "Key serializer: " + pb.getKeySerializerFQCN() );
             System.out.println( "Value serializer: " + pb.getValueSerializerFQCN() );
             System.out.println();
+            
+            transaction.commit();
+        }
+        catch ( IOException ioe )
+        {
+            if ( transaction != null )
+            {
+                transaction.abort();
+            }
         }
     }
 
diff --git a/mavibot/src/main/java/org/apache/directory/mavibot/btree/ReadTransaction.java b/mavibot/src/main/java/org/apache/directory/mavibot/btree/ReadTransaction.java
index 0e6a9b8..9093c9b 100644
--- a/mavibot/src/main/java/org/apache/directory/mavibot/btree/ReadTransaction.java
+++ b/mavibot/src/main/java/org/apache/directory/mavibot/btree/ReadTransaction.java
@@ -91,14 +91,17 @@
     @Override
     public void commit() throws IOException
     {
-        // Decrement the counter
-        int txnNumber = recordManagerHeader.txnCounter.decrementAndGet();
-        
-        if ( ( txnNumber == 0 ) && ( recordManager.activeTransactionsList.peek().revision != recordManagerHeader.revision ) )
+        if ( !aborted )
         {
-            // We can cleanup 
-            recordManager.activeTransactionsList.remove( recordManagerHeader );
-            recordManager.deadTransactionsList.add( recordManagerHeader );
+            // Decrement the counter
+            int txnNumber = recordManagerHeader.txnCounter.decrementAndGet();
+            
+            if ( ( txnNumber == 0 ) && ( recordManager.activeTransactionsList.peek().revision != recordManagerHeader.revision ) )
+            {
+                // We can cleanup 
+                recordManager.activeTransactionsList.remove( recordManagerHeader );
+                recordManager.deadTransactionsList.add( recordManagerHeader );
+            }
         }
         
         super.commit();
diff --git a/mavibot/src/main/java/org/apache/directory/mavibot/btree/RecordManager.java b/mavibot/src/main/java/org/apache/directory/mavibot/btree/RecordManager.java
index 91910c3..969b8ec 100644
--- a/mavibot/src/main/java/org/apache/directory/mavibot/btree/RecordManager.java
+++ b/mavibot/src/main/java/org/apache/directory/mavibot/btree/RecordManager.java
@@ -356,8 +356,11 @@
         // First, create the list of btrees <RevisionName, Long>
         listOfBtrees = new ArrayList<>();
         
-        try ( WriteTransaction transaction = beginWriteTransaction() )
+        WriteTransaction transaction = null;
+        
+        try
         {
+            transaction = beginWriteTransaction();
             // Now, create the Copied Page B-tree
             BTree<RevisionName, long[]> copiedPagesBtree = createCopiedPagesBtree( transaction );
     
@@ -366,6 +369,15 @@
             transaction.recordManagerHeader.copiedPagesBtree = copiedPagesBtree;
             transaction.recordManagerHeader.nbBtree++;
             recordManagerHeader.copiedPagesBtree = copiedPagesBtree;
+            
+            transaction.commit();
+        }
+        catch ( IOException ioe )
+        {
+            if ( transaction != null )
+            {
+                transaction.abort();
+            }
         }
     }
 
@@ -424,10 +436,20 @@
                     PageIO[] btreePageIos = readPageIOs( recordManagerHeader.pageSize, btreeOffset, Long.MAX_VALUE );
                     
                     BTree<?, ?> btree = new BTree<>();
+                    Transaction readTxn = null;
                     
-                    try ( Transaction readTxn = new ReadTransaction( this ) )
+                    try
                     {
+                        readTxn = new ReadTransaction( this );
                         loadBtree( readTxn, btreePageIos, btree );
+                        readTxn.commit();
+                    }
+                    catch ( IOException ioe )
+                    {
+                        if ( readTxn != null )
+                        {
+                            readTxn.abort();
+                        }
                     }
 
                     // Add the btree into the map of managed B-trees
@@ -506,8 +528,12 @@
             recordManagerHeader.lastOffset = fileChannel.size();
 
             // read the list of B-trees
-            try ( Transaction transaction = beginReadTransaction() )
+            Transaction transaction = null;
+            
+            try
             {
+                transaction = beginReadTransaction();
+                
                 // read the copied page B-tree
                 PageIO[] copiedPagesPageIos = readPageIOs( recordManagerHeader.pageSize, recordManagerHeader.currentCopiedPagesBtreeOffset, Long.MAX_VALUE );
     
@@ -515,18 +541,29 @@
                 //( ( BTree<RevisionName, long[]> ) recordManagerHeader.copiedPagesBtree ).setRecordManagerHeader( transaction.getRecordManagerHeader() );
     
                 loadBtree( transaction, copiedPagesPageIos, recordManagerHeader.copiedPagesBtree );
+                
+                transaction.commit();
+            }
+            catch ( IOException ioe )
+            {
+                if ( transaction != null )
+                {
+                    transaction.abort();
+                }
             }
 
             Map<String, Long> loadedBtrees = new HashMap<>();
 
             // Now, read all the B-trees from the btree of btrees
             loadListOfBtrees( recordManagerHeader, loadedBtrees );
-            
+
             /*
-            try ( Transaction transaction = beginReadTransaction() )
-            {
+            Transaction readTxn = null;
             
-                TupleCursor<NameRevision, Long> btreeCursor = null; //transaction.getRecordManagerHeader().listOfBtrees.browse( transaction );
+            try
+            {
+                readTxn = beginReadTransaction();
+                TupleCursor<NameRevision, Long> btreeCursor = null; //readTxn.getRecordManagerHeader().listOfBtrees.browse( transaction );
     
                 // loop on all the btrees we have, and keep only the latest revision
                 long currentRevision = -1L;
@@ -569,11 +606,20 @@
                     PageIO[] btreePageIos = readPageIOs( recordManagerHeader.pageSize, btreeOffset, Long.MAX_VALUE );
                 
                     BTree<?, ?> btree = new BTree<>();
-                    loadBtree( transaction, btreePageIos, btree );
+                    loadBtree( readTxn, btreePageIos, btree );
 
                     // Add the btree into the map of managed B-trees
                     recordManagerHeader.btreeMap.put( loadedBtree.getKey(), ( BTree<Object, Object> ) btree );
                 }
+                
+                readTxn.commit();
+            }
+            catch ( IOException ioe )
+            {
+                if ( readTxn != null )
+                {
+                    readTxn.abort();
+                }
             }
             */
         }
@@ -1551,7 +1597,7 @@
      * +--+--+--+--+
      * |  |  |  |  |                pageID
      * +--+--+--+--+
-     * |  |  |  |  |                number of transactions
+     * |  |  |  |  |                number of transaction lists
      * +--+--+--+--+
      *                              The current RMH :
      * +--+--+--+--+
diff --git a/mavibot/src/main/java/org/apache/directory/mavibot/btree/WriteTransaction.java b/mavibot/src/main/java/org/apache/directory/mavibot/btree/WriteTransaction.java
index eb99e1a..d9267a0 100644
--- a/mavibot/src/main/java/org/apache/directory/mavibot/btree/WriteTransaction.java
+++ b/mavibot/src/main/java/org/apache/directory/mavibot/btree/WriteTransaction.java
@@ -103,7 +103,7 @@
     @Override
     public void commit() throws IOException
     {
-        if ( !isClosed() )
+        if ( !isClosed() && !aborted )
         {
             // First, find the modified users B-trees, and flush the user's pages 
             Set<BTreeInfo<?, ?>> btreeInfos = new HashSet<>();
@@ -226,6 +226,7 @@
         // We just have to empty the maps
         newPages.clear();
         copiedPageMap.clear();
+        aborted = true;
         super.close();
     }
 
diff --git a/mavibot/src/test/java/org/apache/directory/mavibot/btree/BTreeBrowseTest.java b/mavibot/src/test/java/org/apache/directory/mavibot/btree/BTreeBrowseTest.java
index 272f16d..8de6ff8 100644
--- a/mavibot/src/test/java/org/apache/directory/mavibot/btree/BTreeBrowseTest.java
+++ b/mavibot/src/test/java/org/apache/directory/mavibot/btree/BTreeBrowseTest.java
@@ -61,8 +61,6 @@
 
     private RecordManager recordManager = null;
     
-    private Transaction transaction;
-
     @Rule
     public TemporaryFolder tempFolder = new TemporaryFolder();
 
@@ -80,19 +78,33 @@
         openRecordManagerAndBtree();
 
         // Create a new BTree
-        try ( WriteTransaction transaction = recordManager.beginWriteTransaction() )
+        WriteTransaction writeTxn = null;
+        try
         {
-            btree = recordManager.addBTree( transaction, "test", LongSerializer.INSTANCE, StringSerializer.INSTANCE );
+            writeTxn = recordManager.beginWriteTransaction();
+            btree = recordManager.addBTree( writeTxn, "test", LongSerializer.INSTANCE, StringSerializer.INSTANCE );
+            writeTxn.commit();
         }
         catch ( Exception e )
         {
-            transaction.abort();
+            writeTxn.abort();
             throw new RuntimeException( e );
         }
 
-        try ( Transaction transaction = recordManager.beginReadTransaction() )
+        Transaction readTxn = null;
+        
+        try
         {
-            //MavibotInspector.dumpInfos( recordManager, transaction.getRecordManagerHeader() );
+            readTxn = recordManager.beginReadTransaction();
+            //MavibotInspector.dumpInfos( recordManager, readTxn.getRecordManagerHeader() );
+            readTxn.commit();
+        }
+        catch ( Exception e )
+        {
+            if ( readTxn != null )
+            {
+                readTxn.abort();
+            }
         }
     }
 
@@ -125,24 +137,44 @@
 
             // Now, try to reload the file back
             recordManager = new RecordManager( dataDir.getAbsolutePath(), 1024, 1000 );
-
-            try ( Transaction transaction = recordManager.beginReadTransaction() )
+            Transaction readTxn = null;
+            
+            try
             {
-                //MavibotInspector.dumpInfos( recordManager, transaction.getRecordManagerHeader() );
-            }
-
-            // load the last created btree
-            try ( Transaction transaction = recordManager.beginReadTransaction() )
-            {
-                if ( btree != null )
-                {
-                    btree = transaction.getBTree( btree.getName() );
-                }
+                readTxn = recordManager.beginReadTransaction();
+                
+                //MavibotInspector.dumpInfos( recordManager, readTxn.getRecordManagerHeader() );
+                
+                readTxn.commit();
             }
             catch ( Exception e )
             {
-                transaction.abort();
-                throw e;
+                if ( readTxn != null )
+                {
+                    readTxn.abort();
+                }
+            }
+
+            // load the last created btree
+            readTxn = null;
+            
+            try
+            {
+                readTxn = recordManager.beginReadTransaction();
+                
+                if ( btree != null )
+                {
+                    btree = readTxn.getBTree( btree.getName() );
+                }
+                
+                readTxn.commit();
+            }
+            catch ( Exception e )
+            {
+                if ( readTxn != null )
+                {
+                    readTxn.abort();
+                }
             }
         }
         catch ( Exception e )
@@ -228,10 +260,14 @@
     @Test
     public void testBrowseEmptyBTree() throws IOException, BTreeAlreadyManagedException, KeyNotFoundException, CursorException
     {
-        try ( Transaction transaction  = recordManager.beginReadTransaction() )
+        Transaction readTxn = null;
+        
+        try
         {
-            btree = transaction.getBTree( "test" );
-            TupleCursor<Long, String> cursor = btree.browse( transaction );
+            readTxn = recordManager.beginReadTransaction();
+
+            btree = readTxn.getBTree( "test" );
+            TupleCursor<Long, String> cursor = btree.browse( readTxn );
     
             assertFalse( cursor.hasNext() );
             assertFalse( cursor.hasPrev() );
@@ -257,6 +293,15 @@
             }
     
             assertEquals( 2L, cursor.getRevision() );
+            
+            readTxn.commit();
+        }
+        catch ( Exception e )
+        {
+            if ( readTxn != null )
+            {
+                readTxn.abort();
+            }
         }
     }
 
@@ -268,19 +313,36 @@
     public void testBrowseBTreeLeafNext() throws Exception
     {
         // Inject some data
-        try ( WriteTransaction writeTxn = recordManager.beginWriteTransaction() )
+        WriteTransaction writeTxn = null;
+        
+        try
         {
+            writeTxn = recordManager.beginWriteTransaction();
+
             BTree<Long, String> btree = writeTxn.getBTree( "test" );
             btree.insert( writeTxn, 1L, "1" );
             btree.insert( writeTxn, 4L, "4" );
             btree.insert( writeTxn, 2L, "2" );
             btree.insert( writeTxn, 3L, "3" );
             btree.insert( writeTxn, 5L, "5" );
+            
+            writeTxn.commit();
+        }
+        catch ( IOException ioe )
+        {
+            if ( writeTxn != null )
+            {
+                writeTxn.abort();
+            }
         }
 
         // Create the cursor
-        try ( Transaction readTxn = recordManager.beginReadTransaction() )
+        Transaction readTxn = null;
+        
+        try
         {
+            readTxn = recordManager.beginReadTransaction();
+            
             BTree<Long, String> btree = readTxn.getBTree( "test" );
             TupleCursor<Long, String> cursor = btree.browse( readTxn );
     
@@ -295,6 +357,15 @@
             checkNext( cursor, 3L, "3", true, true );
             checkNext( cursor, 4L, "4", true, true );
             checkNext( cursor, 5L, "5", false, true );
+            
+            readTxn.commit();
+        }
+        catch ( Exception e )
+        {
+            if ( readTxn != null )
+            {
+                readTxn.abort();
+            }
         }
     }
 
@@ -306,19 +377,36 @@
     public void testBrowseBTreeLeafPrev() throws IOException, BTreeAlreadyManagedException, KeyNotFoundException, CursorException
     {
         // Inject some data
-        try ( WriteTransaction writeTxn = recordManager.beginWriteTransaction() )
+        WriteTransaction writeTxn = null;
+        
+        try
         {
+            writeTxn = recordManager.beginWriteTransaction();
+            
             BTree<Long, String> btree = writeTxn.getBTree( "test" );
             btree.insert( writeTxn, 1L, "1" );
             btree.insert( writeTxn, 4L, "4" );
             btree.insert( writeTxn, 2L, "2" );
             btree.insert( writeTxn, 3L, "3" );
             btree.insert( writeTxn, 5L, "5" );
+            
+            writeTxn.commit();
+        }
+        catch ( IOException ioe )
+        {
+            if ( writeTxn != null )
+            {
+                writeTxn.abort();
+            }
         }
 
         // Create the cursor
-        try ( Transaction readTxn = recordManager.beginReadTransaction() )
+        Transaction readTxn = null;
+        
+        try
         {
+            readTxn = recordManager.beginReadTransaction();
+
             BTree<Long, String> btree = readTxn.getBTree( "test" );
             TupleCursor<Long, String> cursor = btree.browse( readTxn );
     
@@ -330,6 +418,15 @@
             checkPrev( cursor, 3L, "3", true, true );
             checkPrev( cursor, 2L, "2", true, true );
             checkPrev( cursor, 1L, "1", true, false );
+            
+            readTxn.commit();
+        }
+        catch ( Exception e )
+        {
+            if ( readTxn != null )
+            {
+                readTxn.abort();
+            }
         }
     }
 
@@ -342,19 +439,36 @@
     public void testBrowseBTreeLeafFirstLast() throws IOException, BTreeAlreadyManagedException, KeyNotFoundException, CursorException
     {
         // Inject some data
-        try ( WriteTransaction writeTxn = recordManager.beginWriteTransaction() )
+        WriteTransaction writeTxn = null;
+        
+        try
         {
+            writeTxn = recordManager.beginWriteTransaction();
+            
             BTree<Long, String> btree = writeTxn.getBTree( "test" );
             btree.insert( writeTxn, 1L, "1" );
             btree.insert( writeTxn, 4L, "4" );
             btree.insert( writeTxn, 2L, "2" );
             btree.insert( writeTxn, 3L, "3" );
             btree.insert( writeTxn, 5L, "5" );
+            
+            writeTxn.commit();
+        }
+        catch ( IOException ioe )
+        {
+            if ( writeTxn != null )
+            {
+                writeTxn.abort();
+            }
         }
 
         // Create the cursor
-        try ( Transaction readTxn = recordManager.beginReadTransaction() )
+        Transaction readTxn = null;
+        
+        try
         {
+            readTxn = recordManager.beginReadTransaction();
+
             BTree<Long, String> btree = readTxn.getBTree( "test" );
             TupleCursor<Long, String> cursor = btree.browse( readTxn );
     
@@ -420,6 +534,15 @@
     
             assertFalse( cursor.hasPrev() );
             assertTrue( cursor.hasNext() );
+            
+            readTxn.commit();
+        }
+        catch ( Exception e )
+        {
+            if ( readTxn != null )
+            {
+                readTxn.abort();
+            }
         }
     }
 
@@ -432,19 +555,36 @@
     public void testBrowseBTreeLeafNextPrev() throws IOException, BTreeAlreadyManagedException, KeyNotFoundException, CursorException
     {
         // Inject some data
-        try ( WriteTransaction writeTxn = recordManager.beginWriteTransaction() )
+        WriteTransaction writeTxn = null;
+        
+        try
         {
+            writeTxn = recordManager.beginWriteTransaction();
+            
             BTree<Long, String> btree = writeTxn.getBTree( "test" );
             btree.insert( writeTxn, 1L, "1" );
             btree.insert( writeTxn, 4L, "4" );
             btree.insert( writeTxn, 2L, "2" );
             btree.insert( writeTxn, 3L, "3" );
             btree.insert( writeTxn, 5L, "5" );
+            
+            writeTxn.commit();
+        }
+        catch ( IOException ioe )
+        {
+            if ( writeTxn != null )
+            {
+                writeTxn.abort();
+            }
         }
 
         // Create the cursor
-        try ( Transaction readTxn = recordManager.beginReadTransaction() )
+        Transaction readTxn = null;
+        
+        try
         {
+            readTxn = recordManager.beginReadTransaction();
+
             BTree<Long, String> btree = readTxn.getBTree( "test" );
             TupleCursor<Long, String> cursor = btree.browse( readTxn );
     
@@ -481,6 +621,15 @@
             tuple = cursor.next();
             assertEquals( 3L, ( long ) tuple.getKey() );
             assertEquals( "3", tuple.getValue() );
+            
+            readTxn.commit();
+        }
+        catch ( Exception e )
+        {
+            if ( readTxn != null )
+            {
+                readTxn.abort();
+            }
         }
     }
     
@@ -577,8 +726,12 @@
         for ( long i = 0; i < nbRound/increment; i++ )
         {
             //System.out.println( "\nInserting " + i + " in the tree ---->" );
-            try ( WriteTransaction writeTxn = recordManager.beginWriteTransaction() )
+            WriteTransaction writeTxn = null;
+            
+            try
             {
+                writeTxn = recordManager.beginWriteTransaction();
+                
                 BTree<Long, String> btree = writeTxn.getBTree( "test" );
                 
                 for ( long j = 0; j < increment; j++ )
@@ -588,6 +741,15 @@
                     //MavibotInspector.check( recordManager, recordManager.getRecordManagerHeader() );
                     btree.insert( writeTxn, val, Long.toString( val ) );
                 }
+                
+                writeTxn.commit();
+            }
+            catch ( IOException ioe )
+            {
+                if ( writeTxn != null )
+                {
+                    writeTxn.abort();
+                }
             }
         }
         long t1 = System.currentTimeMillis();
@@ -599,8 +761,12 @@
         //MavibotInspector.check( recordManager, recordManager.getRecordManagerHeader() );
 
         // Create the cursor
-        try ( Transaction readTxn = recordManager.beginReadTransaction() )
+        Transaction readTxn = null;
+        
+        try
         {
+            readTxn = recordManager.beginReadTransaction();
+
             BTree<Long, String> btree = readTxn.getBTree( "test" );
             TupleCursor<Long, String> cursor = btree.browse( readTxn );
 
@@ -644,6 +810,15 @@
             System.out.println( "Delta browse : " + ( t1 - t0 ) );
             System.out.println( "Nb cache hits : " + recordManager.nbCacheHits.get() );
             System.out.println( "Nb cache misses : " + recordManager.nbCacheMisses.get() );
+            
+            readTxn.commit();
+        }
+        catch ( Exception e )
+        {
+            if ( readTxn != null )
+            {
+                readTxn.abort();
+            }
         }
     }
     
@@ -668,8 +843,12 @@
 
         for ( long i = 0; i < nbRound/increment; i++ )
         {
-            try ( WriteTransaction writeTxn = recordManager.beginWriteTransaction() )
+            WriteTransaction writeTxn = null;
+            
+            try
             {
+                writeTxn = recordManager.beginWriteTransaction();
+                
                 BTree<Long, String> btree = writeTxn.getBTree( "test" );
 
                 for ( long j = 0; j < increment; j++ )
@@ -678,6 +857,15 @@
                     //MavibotInspector.check( recordManager, recordManager.getRecordManagerHeader() );
                     btree.insert( writeTxn, val, Long.toString( val ) );
                 }
+                
+                writeTxn.commit();
+            }
+            catch ( IOException ioe )
+            {
+                if ( writeTxn != null )
+                {
+                    writeTxn.abort();
+                }
             }
         }
 
@@ -699,8 +887,12 @@
             for ( int i = 0; i < 10; i++ )
             {
                 int counter = 0;
-                try ( Transaction readTxn = recordManager.beginReadTransaction() )
+                Transaction readTxn = null;
+                
+                try
                 {
+                    readTxn = recordManager.beginReadTransaction();
+
                     BTree<Long, String> btree = readTxn.getBTree( "test" );
                     
                     for ( int j = 0; j < nbRound; j++ )
@@ -719,8 +911,17 @@
                         counter++;
                     }
                     */
+                    
+                    readTxn.commit();
                 }
-            
+                catch ( Exception e )
+                {
+                    if ( readTxn != null )
+                    {
+                        readTxn.abort();
+                    }
+                }
+
                 assertEquals( nbRound, counter );
             }
 
@@ -760,8 +961,12 @@
         for ( long i = 0; i < nbRound/increment; i++ )
         {
             //System.out.println( "\nInserting " + i + " in the tree ---->" );
-            try ( WriteTransaction writeTxn = recordManager.beginWriteTransaction() )
+            WriteTransaction writeTxn = null;
+            
+            try
             {
+                writeTxn = recordManager.beginWriteTransaction();
+                
                 BTree<Long, String> btree = writeTxn.getBTree( "test" );
 
                 for ( long j = 0; j < increment; j++ )
@@ -771,6 +976,15 @@
                     //MavibotInspector.check( recordManager, recordManager.getRecordManagerHeader() );
                     btree.delete( writeTxn, val );
                 }
+                
+                writeTxn.commit();
+            }
+            catch ( IOException ioe )
+            {
+                if ( writeTxn != null )
+                {
+                    writeTxn.abort();
+                }
             }
         }
 
@@ -808,8 +1022,12 @@
 
         for ( long i = 0; i < nbRound/increment; i++ )
         {
-            try ( WriteTransaction writeTxn = recordManager.beginWriteTransaction() )
+            WriteTransaction writeTxn = null;
+            
+            try
             {
+                writeTxn = recordManager.beginWriteTransaction();
+                
                 BTree<Long, String> btree = writeTxn.getBTree( "test" );
 
                 for ( long j = 0; j < increment; j++ )
@@ -819,6 +1037,15 @@
                     //MavibotInspector.check( recordManager, recordManager.getRecordManagerHeader() );
                     btree.insert( writeTxn, val, Long.toString( val ) );
                 }
+                
+                writeTxn.commit();
+            }
+            catch ( IOException ioe )
+            {
+                if ( writeTxn != null )
+                {
+                    writeTxn.abort();
+                }
             }
         }
 
@@ -831,8 +1058,12 @@
         
         int counter = 0;
 
-        try ( Transaction readTxn = recordManager.beginReadTransaction() )
+        Transaction readTxn = null;
+        
+        try
         {
+            readTxn = recordManager.beginReadTransaction();
+
             BTree<Long, String> btree = readTxn.getBTree( "test" );
             TupleCursor<Long, String> cursor = btree.browse( readTxn );
     
@@ -841,8 +1072,17 @@
                 cursor.next();
                 counter++;
             }
+            
+            readTxn.commit();
         }
-        
+        catch ( Exception e )
+        {
+            if ( readTxn != null )
+            {
+                readTxn.abort();
+            }
+        }
+
         assertEquals( nbRound, counter );
         
         // Now delete the elements
@@ -862,8 +1102,12 @@
         for ( long i = 0; i < nbRound/increment; i++ )
         {
             //System.out.println( "\nInserting " + i + " in the tree ---->" );
-            try ( WriteTransaction writeTxn = recordManager.beginWriteTransaction() )
+            WriteTransaction writeTxn = null;
+            
+            try
             {
+                writeTxn = recordManager.beginWriteTransaction();
+                
                 BTree<Long, String> btree = writeTxn.getBTree( "test" );
 
                 for ( long j = 0; j < increment; j++ )
@@ -873,6 +1117,15 @@
                     //MavibotInspector.check( recordManager, recordManager.getRecordManagerHeader() );
                     btree.delete( writeTxn, val );
                 }
+                
+                writeTxn.commit();
+            }
+            catch ( IOException ioe )
+            {
+                if ( writeTxn != null )
+                {
+                    writeTxn.abort();
+                }
             }
         }
     }
@@ -989,8 +1242,12 @@
         for ( long i = 0; i < nbRound/increment; i++ )
         {
             //System.out.println( "\nInserting " + i + " in the tree ---->" );
-            try ( WriteTransaction writeTxn = recordManager.beginWriteTransaction() )
+            WriteTransaction writeTxn = null;
+            
+            try
             {
+                writeTxn = recordManager.beginWriteTransaction();
+                
                 BTree<Long, String> btree = writeTxn.getBTree( "test" );
 
                 for ( long j = 0; j < increment; j++ )
@@ -999,6 +1256,15 @@
                     //MavibotInspector.check( recordManager, recordManager.getRecordManagerHeader() );
                     btree.insert( writeTxn, val, Long.toString( val ) );
                 }
+                
+                writeTxn.commit();
+            }
+            catch ( IOException ioe )
+            {
+                if ( writeTxn != null )
+                {
+                    writeTxn.abort();
+                }
             }
         }
 
@@ -1007,8 +1273,12 @@
         System.out.println( "Delta for " + nbRound + " : " + ( t1 - t0 ) );
         int counter = 0;
 
-        try ( Transaction readTxn = recordManager.beginReadTransaction() )
+        Transaction readTxn = null;
+        
+        try
         {
+            readTxn = recordManager.beginReadTransaction();
+
             BTree<Long, String> btree = readTxn.getBTree( "test" );
             TupleCursor<Long, String> cursor = btree.browse( readTxn );
     
@@ -1017,13 +1287,35 @@
                 cursor.next();
                 counter++;
             }
+            
+            readTxn.commit();
         }
-        
+        catch ( Exception e )
+        {
+            if ( readTxn != null )
+            {
+                readTxn.abort();
+            }
+        }
+
         assertEquals( nbRound, counter );
 
-        try ( Transaction readTxn = recordManager.beginReadTransaction() )
+        readTxn = null;
+        
+        try
         {
+            readTxn = recordManager.beginReadTransaction();
+
             BTree<Long, String> btree = readTxn.getBTree( "test" );
+            
+            readTxn.commit();
+        }
+        catch ( Exception e )
+        {
+            if ( readTxn != null )
+            {
+                readTxn.abort();
+            }
         }
 
         // Now delete the elements
@@ -1087,8 +1379,12 @@
         for ( long i = 0; i < nbRound/increment; i++ )
         {
             //System.out.println( "\nInserting " + i + " in the tree ---->" );
-            try ( WriteTransaction writeTxn = recordManager.beginWriteTransaction() )
+            WriteTransaction writeTxn = null;
+            
+            try
             {
+                writeTxn = recordManager.beginWriteTransaction();
+                
                 BTree<Long, String> btree = writeTxn.getBTree( "test" );
 
                 for ( long j = 0; j < increment; j++ )
@@ -1098,6 +1394,15 @@
                     //MavibotInspector.check( recordManager, recordManager.getRecordManagerHeader() );
                     btree.delete( writeTxn, val );
                 }
+                
+                writeTxn.commit();
+            }
+            catch ( IOException ioe )
+            {
+                if ( writeTxn != null )
+                {
+                    writeTxn.abort();
+                }
             }
         }
     }
@@ -1136,8 +1441,12 @@
         for ( long i = 0; i < nbRound/increment; i++ )
         {
             //System.out.println( "\nInserting " + i + " in the tree ---->" );
-            try ( WriteTransaction writeTxn = recordManager.beginWriteTransaction() )
+            WriteTransaction writeTxn = null;
+            
+            try
             {
+                writeTxn = recordManager.beginWriteTransaction();
+                
                 BTree<Long, String> btree = writeTxn.getBTree( "test" );
 
                 for ( long j = 0; j < increment; j++ )
@@ -1147,6 +1456,15 @@
                     //MavibotInspector.check( recordManager, recordManager.getRecordManagerHeader() );
                     btree.insert( writeTxn, val, Long.toString( val ) );
                 }
+                
+                writeTxn.commit();
+            }
+            catch ( IOException ioe )
+            {
+                if ( writeTxn != null )
+                {
+                    writeTxn.abort();
+                }
             }
         }
 
@@ -1155,8 +1473,12 @@
         System.out.println( "Delta for " + nbRound + " : " + ( t1 - t0 ) );
         int counter = 0;
 
-        try ( Transaction readTxn = recordManager.beginReadTransaction() )
+        Transaction readTxn = null;
+        
+        try
         {
+            readTxn = recordManager.beginReadTransaction();
+
             BTree<Long, String> btree = readTxn.getBTree( "test" );
             TupleCursor<Long, String> cursor = btree.browse( readTxn );
     
@@ -1165,8 +1487,17 @@
                 cursor.next();
                 counter++;
             }
+            
+            readTxn.commit();
         }
-        
+        catch ( Exception e )
+        {
+            if ( readTxn != null )
+            {
+                readTxn.abort();
+            }
+        }
+
         assertEquals( nbRound, counter );
         
         // Now delete the elements
@@ -1190,8 +1521,12 @@
         for ( long i = 0; i < nbRound/increment; i++ )
         {
             //System.out.println( "\nInserting " + i + " in the tree ---->" );
-            try ( WriteTransaction writeTxn = recordManager.beginWriteTransaction() )
+            WriteTransaction writeTxn = null;
+            
+            try
             {
+                writeTxn = recordManager.beginWriteTransaction();
+                
                 BTree<Long, String> btree = writeTxn.getBTree( "test" );
 
                 for ( long j = 0; j < increment; j++ )
@@ -1202,6 +1537,15 @@
                     //MavibotInspector.check( recordManager, recordManager.getRecordManagerHeader() );
                     btree.delete( writeTxn, val );
                 }
+                
+                writeTxn.commit();
+            }
+            catch ( IOException ioe )
+            {
+                if ( writeTxn != null )
+                {
+                    writeTxn.abort();
+                }
             }
         }
 
@@ -1240,8 +1584,12 @@
         for ( long i = 0; i < nbRound/increment; i++ )
         {
             //System.out.println( "\nInserting " + i + " in the tree ---->" );
-            try ( WriteTransaction writeTxn = recordManager.beginWriteTransaction() )
+            WriteTransaction writeTxn = null;
+            
+            try
             {
+                writeTxn = recordManager.beginWriteTransaction();
+                
                 BTree<Long, String> btree = writeTxn.getBTree( "test" );
 
                 for ( long j = 0; j < increment; j++ )
@@ -1253,6 +1601,15 @@
                 }
                 
                 System.out.println( btree );
+                
+                writeTxn.commit();
+            }
+            catch ( IOException ioe )
+            {
+                if ( writeTxn != null )
+                {
+                    writeTxn.abort();
+                }
             }
         }
 
@@ -1268,8 +1625,12 @@
 
         for ( long i = 0; i < nbRound/increment; i++ )
         {
-            try ( WriteTransaction writeTxn = recordManager.beginWriteTransaction() )
+            WriteTransaction writeTxn = null;
+            
+            try
             {
+                writeTxn = recordManager.beginWriteTransaction();
+                
                 BTree<Long, String> btree = writeTxn.getBTree( "test" );
                 
                 for ( long j = 0; j < increment; j++ )
@@ -1280,6 +1641,15 @@
                     btree.delete( writeTxn, val );
                     System.out.println( btree );
                 }
+                
+                writeTxn.commit();
+            }
+            catch ( IOException ioe )
+            {
+                if ( writeTxn != null )
+                {
+                    writeTxn.abort();
+                }
             }
         }
     }
@@ -1298,8 +1668,12 @@
         
         for ( long i = 0; i < nbRound/increment; i++ )
         {
-            try ( WriteTransaction writeTxn = recordManager.beginWriteTransaction() )
+            WriteTransaction writeTxn = null;
+            
+            try
             {
+                writeTxn = recordManager.beginWriteTransaction();
+                
                 BTree<Long, String> btree = writeTxn.getBTree( "test" );
 
                 for ( long j = 0; j < increment; j++ )
@@ -1308,6 +1682,15 @@
                     //MavibotInspector.check( recordManager, recordManager.getRecordManagerHeader() );
                     btree.insert( writeTxn, val, Long.toString( val ) );
                 }
+                
+                writeTxn.commit();
+            }
+            catch ( IOException ioe )
+            {
+                if ( writeTxn != null )
+                {
+                    writeTxn.abort();
+                }
             }
         }
 
@@ -1330,8 +1713,12 @@
         
         for ( int i = 0; i < nbRound/increment; i++ )
         {
-            try ( WriteTransaction writeTxn = recordManager.beginWriteTransaction() )
+            WriteTransaction writeTxn = null;
+            
+            try
             {
+                writeTxn = recordManager.beginWriteTransaction();
+                
                 BTree<Long, String> btree = writeTxn.getBTree( "test" );
 
                 for ( int j = 0; j < increment; j++ )
@@ -1340,11 +1727,24 @@
                     //MavibotInspector.check( recordManager, recordManager.getRecordManagerHeader() );
                     btree.delete( writeTxn, values[index] );
                 }
+                
+                writeTxn.commit();
             }
-            
-            // Check that we can still browse the tree
-            try ( Transaction readTxn = recordManager.beginReadTransaction() )
+            catch ( IOException ioe )
             {
+                if ( writeTxn != null )
+                {
+                    writeTxn.abort();
+                }
+            }
+
+            // Check that we can still browse the tree
+            Transaction readTxn = null;
+            
+            try
+            {
+                readTxn = recordManager.beginReadTransaction();
+
                 BTree<Long, String> readBtree = readTxn.getBTree( "test" );
                 TupleCursor<Long, String> cursor = readBtree.browse( readTxn );
                 
@@ -1358,6 +1758,15 @@
                 }
                 
                 assertEquals( nbElems, nbRound - increment * ( i + 1 ) );
+                
+                readTxn.commit();
+            }
+            catch ( Exception e )
+            {
+                if ( readTxn != null )
+                {
+                    readTxn.abort();
+                }
             }
         }
 
@@ -1366,8 +1775,12 @@
         System.out.println( "Delta delete    : " + ( t11 - t10 ) );
 
         // Create the cursor
-        try ( Transaction readTxn = recordManager.beginReadTransaction() )
+        Transaction readTxn = null;
+        
+        try
         {
+            readTxn = recordManager.beginReadTransaction();
+
             BTree<Long, String> btree = readTxn.getBTree( "test" );
             TupleCursor<Long, String> cursor = btree.browse( readTxn );
 
@@ -1377,6 +1790,15 @@
     
             assertFalse( cursor.hasPrev() );
             assertFalse( cursor.hasNext() );
+            
+            readTxn.commit();
+        }
+        catch ( Exception e )
+        {
+            if ( readTxn != null )
+            {
+                readTxn.abort();
+            }
         }
     }
 
@@ -1388,20 +1810,37 @@
     public void testBrowseBTreeNodesPrev() throws IOException, BTreeAlreadyManagedException, KeyNotFoundException, CursorException
     {
         // Inject some data
-        try ( WriteTransaction writeTxn = recordManager.beginWriteTransaction() )
+        WriteTransaction writeTxn = null;
+        
+        try
         {
+            writeTxn = recordManager.beginWriteTransaction();
+            
             BTree<Long, String> btree = writeTxn.getBTree( "test" );
             for ( long i = 1; i < 1_000L; i++ )
             {
                 btree.insert( writeTxn, i, Long.toString( i ) );
             }
+            
+            writeTxn.commit();
+        }
+        catch ( IOException ioe )
+        {
+            if ( writeTxn != null )
+            {
+                writeTxn.abort();
+            }
         }
 
         //MavibotInspector.check( recordManager, recordManager.getCurrentRecordManagerHeader() );
 
         // Create the cursor
-        try ( Transaction readTxn = recordManager.beginReadTransaction() )
+        Transaction readTxn = null;
+        
+        try
         {
+            readTxn = recordManager.beginReadTransaction();
+
             BTree<Long, String> btree = readTxn.getBTree( "test" );
             TupleCursor<Long, String> cursor = btree.browse( readTxn );
 
@@ -1421,6 +1860,15 @@
             assertTrue( cursor.hasPrev() );
 
             checkPrev( cursor, 1L, "1", true, false );
+            
+            readTxn.commit();
+        }
+        catch ( Exception e )
+        {
+            if ( readTxn != null )
+            {
+                readTxn.abort();
+            }
         }
     }
 
@@ -1432,8 +1880,12 @@
     public void testBrowseBTreeLeafNextDupsN() throws IOException, BTreeAlreadyManagedException, KeyNotFoundException, CursorException
     {
         // Inject some duplicate data
-        try ( WriteTransaction writeTxn = recordManager.beginWriteTransaction() )
+        WriteTransaction writeTxn = null;
+        
+        try
         {
+            writeTxn = recordManager.beginWriteTransaction();
+            
             BTree<Long, String> btree = writeTxn.getBTree( "test" );
             btree.insert( writeTxn, 1L, "1" );
             btree.insert( writeTxn, 1L, "4" );
@@ -1442,11 +1894,24 @@
             btree.insert( writeTxn, 3L, "5" );
             btree.insert( writeTxn, 3L, "7" );
             btree.insert( writeTxn, 3L, "6" );
+            
+            writeTxn.commit();
+        }
+        catch ( IOException ioe )
+        {
+            if ( writeTxn != null )
+            {
+                writeTxn.abort();
+            }
         }
 
         // Create the cursor
-        try ( Transaction readTxn = recordManager.beginReadTransaction() )
+        Transaction readTxn = null;
+        
+        try
         {
+            readTxn = recordManager.beginReadTransaction();
+
             BTree<Long, String> btree = readTxn.getBTree( "test" );
             TupleCursor<Long, String> cursor = btree.browse( readTxn );
     
@@ -1459,6 +1924,15 @@
             checkNext( cursor, 1L, "2", true, false );
             checkNext( cursor, 2L, "3", true, true );
             checkNext( cursor, 3L, "6", false, true );
+            
+            readTxn.commit();
+        }
+        catch ( Exception e )
+        {
+            if ( readTxn != null )
+            {
+                readTxn.abort();
+            }
         }
     }
 
@@ -1472,8 +1946,12 @@
     @Test
     public void testBrowseFromEmptyBTree() throws IOException, BTreeAlreadyManagedException
     {
-        try ( Transaction readTxn = recordManager.beginReadTransaction() )
+        Transaction readTxn = null;
+        
+        try
         {
+            readTxn = recordManager.beginReadTransaction();
+
             BTree<Long, String> btree = readTxn.getBTree( "test" );
             TupleCursor<Long, String> cursor = btree.browseFrom( readTxn, 1L );
     
@@ -1501,6 +1979,15 @@
             }
     
             assertEquals( -1L, cursor.getRevision() );
+            
+            readTxn.commit();
+        }
+        catch ( Exception e )
+        {
+            if ( readTxn != null )
+            {
+                readTxn.abort();
+            }
         }
     }
 
@@ -1512,19 +1999,36 @@
     public void testBrowseFromBTreeLeaf() throws IOException, BTreeAlreadyManagedException
     {
         // Inject some data
-        try ( WriteTransaction writeTxn = recordManager.beginWriteTransaction() )
+        WriteTransaction writeTxn = null;
+        
+        try
         {
+            writeTxn = recordManager.beginWriteTransaction();
+            
             BTree<Long, String> btree = writeTxn.getBTree( "test" );
             btree.insert( writeTxn, 1L, "1" );
             btree.insert( writeTxn, 7L, "7" );
             btree.insert( writeTxn, 3L, "3" );
             btree.insert( writeTxn, 5L, "5" );
             btree.insert( writeTxn, 9L, "9" );
+            
+            writeTxn.commit();
+        }
+        catch ( IOException ioe )
+        {
+            if ( writeTxn != null )
+            {
+                writeTxn.abort();
+            }
         }
 
         // Create the cursor, starting at 5
-        try ( Transaction readTxn = recordManager.beginReadTransaction() )
+        Transaction readTxn = null;
+        
+        try
         {
+            readTxn = recordManager.beginReadTransaction();
+
             BTree<Long, String> btree = readTxn.getBTree( "test" );
             TupleCursor<Long, String> cursor = btree.browseFrom( readTxn, 5L );
     
@@ -1591,6 +2095,15 @@
             cursor = btree.browseFrom( readTxn, 4L );
     
             checkPrev( cursor, 3L, "3", true, true );
+            
+            readTxn.commit();
+        }
+        catch ( Exception e )
+        {
+            if ( readTxn != null )
+            {
+                readTxn.abort();
+            }
         }
     }
 
@@ -1602,25 +2115,51 @@
     public void testBrowseFromBTreeNodesNotExistingKey() throws IOException, BTreeAlreadyManagedException
     {
         // Inject some data
-        try ( WriteTransaction writeTxn = recordManager.beginWriteTransaction() )
+        WriteTransaction writeTxn = null;
+        
+        try
         {
+            writeTxn = recordManager.beginWriteTransaction();
+            
             BTree<Long, String> btree = writeTxn.getBTree( "test" );
 
             for ( long i = 0; i <= 1000L; i += 2 )
             {
                 btree.insert( writeTxn, i, Long.toString( i ) );
             }
+            
+            writeTxn.commit();
+        }
+        catch ( IOException ioe )
+        {
+            if ( writeTxn != null )
+            {
+                writeTxn.abort();
+            }
         }
 
         // Create the cursor
-        try ( Transaction readTxn = recordManager.beginReadTransaction() )
+        Transaction readTxn = null;
+        
+        try
         {
+            readTxn = recordManager.beginReadTransaction();
+
             BTree<Long, String> btree = readTxn.getBTree( "test" );
             TupleCursor<Long, String> cursor = btree.browseFrom( readTxn, 1500L );
     
             assertFalse( cursor.hasNext() );
             assertTrue( cursor.hasPrev() );
             assertEquals( 1000L, cursor.prev().getKey().longValue() );
+            
+            readTxn.commit();
+        }
+        catch ( Exception e )
+        {
+            if ( readTxn != null )
+            {
+                readTxn.abort();
+            }
         }
     }
 
@@ -1634,8 +2173,12 @@
     public void testPrevKey() throws IOException, BTreeAlreadyManagedException, KeyNotFoundException, CursorException
     {
         // Inject some data
-        try ( WriteTransaction writeTxn = recordManager.beginWriteTransaction() )
+        WriteTransaction writeTxn = null;
+        
+        try
         {
+            writeTxn = recordManager.beginWriteTransaction();
+            
             BTree<Long, String> btree = writeTxn.getBTree( "test" );
             
             for ( long i = 1; i < 1000L; i++ )
@@ -1649,11 +2192,24 @@
                     e.printStackTrace();
                 }
             }
+            
+            writeTxn.commit();
+        }
+        catch ( IOException ioe )
+        {
+            if ( writeTxn != null )
+            {
+                writeTxn.abort();
+            }
         }
 
         // Create the cursor
-        try ( Transaction readTxn = recordManager.beginReadTransaction() )
+        Transaction readTxn = null;
+        
+        try
         {
+            readTxn = recordManager.beginReadTransaction();
+
             BTree<Long, String> btree = readTxn.getBTree( "test" );
             TupleCursor<Long, String> cursor = btree.browse( readTxn );
     
@@ -1683,6 +2239,15 @@
                     next = true;
                 }
             }
+            
+            readTxn.commit();
+        }
+        catch ( Exception e )
+        {
+            if ( readTxn != null )
+            {
+                readTxn.abort();
+            }
         }
     }
 
@@ -1693,26 +2258,65 @@
     @Test
     public void testOverwrite() throws Exception
     {
-        try ( WriteTransaction writeTxn = recordManager.beginWriteTransaction() )
+        WriteTransaction writeTxn = null;
+        
+        try
         {
+            writeTxn = recordManager.beginWriteTransaction();
+            
             BTree<Long, String> btree = writeTxn.getBTree( "test" );
             btree.insert( writeTxn, 1L, "1" );
+            
+            writeTxn.commit();
+        }
+        catch ( IOException ioe )
+        {
+            if ( writeTxn != null )
+            {
+                writeTxn.abort();
+            }
         }
 
-        try ( Transaction readTxn = recordManager.beginReadTransaction() )
+        Transaction readTxn = null;
+        
+        try
         {
+            readTxn = recordManager.beginReadTransaction();
+
             BTree<Long, String> btree = readTxn.getBTree( "test" );
             assertTrue( btree.hasKey( readTxn, 1L ) );
     
             assertEquals( "1", btree.get( readTxn, 1L ) );
     
-            try ( WriteTransaction writeTxn = recordManager.beginWriteTransaction() )
+            writeTxn = null;
+            
+            try
             {
+                writeTxn = recordManager.beginWriteTransaction();
+                
                 btree.insert( writeTxn, 1L, "10" );
+                
+                writeTxn.commit();
             }
-    
+            catch ( IOException ioe )
+            {
+                if ( writeTxn != null )
+                {
+                    writeTxn.abort();
+                }
+            }
+
             assertTrue( btree.hasKey( readTxn, 1L ) );
             assertEquals( "10", btree.get( readTxn, 1L ) );
+            
+            readTxn.commit();
+        }
+        catch ( Exception e )
+        {
+            if ( readTxn != null )
+            {
+                readTxn.abort();
+            }
         }
     
         btree.close();
@@ -1732,19 +2336,36 @@
         btree.setPageNbElem( 4 );
 
         // Inject some data
-        try ( WriteTransaction writeTxn = recordManager.beginWriteTransaction() )
+        WriteTransaction writeTxn = null;
+        
+        try
         {
+            writeTxn = recordManager.beginWriteTransaction();
+            
             for ( long value : values )
             {
                 BTree<Long, String> btree = writeTxn.getBTree( "test" );
                 btree.insert( writeTxn, value, Long.toString( value ) );
             }
+            
+            writeTxn.commit();
+        }
+        catch ( IOException ioe )
+        {
+            if ( writeTxn != null )
+            {
+                writeTxn.abort();
+            }
         }
 
         MavibotInspector.check( recordManager );
 
-        try ( Transaction readTxn = recordManager.beginReadTransaction() )
+        Transaction readTxn = null;
+        
+        try
         {
+            readTxn = recordManager.beginReadTransaction();
+
             BTree<Long, String> btree = readTxn.getBTree( "test" );
             TupleCursor<Long, String> cursor = btree.browse( readTxn );
     
@@ -1752,6 +2373,17 @@
             {
                 cursor.next();
             }
+            
+            readTxn.commit();
+            
+            readTxn.commit();
+        }
+        catch ( Exception e )
+        {
+            if ( readTxn != null )
+            {
+                readTxn.abort();
+            }
         }
     }
 }
\ No newline at end of file
diff --git a/mavibot/src/test/java/org/apache/directory/mavibot/btree/BTreeBuilderTest.java b/mavibot/src/test/java/org/apache/directory/mavibot/btree/BTreeBuilderTest.java
index 56f0ab0..74e29e2 100644
--- a/mavibot/src/test/java/org/apache/directory/mavibot/btree/BTreeBuilderTest.java
+++ b/mavibot/src/test/java/org/apache/directory/mavibot/btree/BTreeBuilderTest.java
@@ -24,6 +24,7 @@
 import static org.junit.Assert.assertEquals;
 
 import java.io.File;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -56,13 +57,13 @@
 
         try
         {
-            RecordManager rm = new RecordManager( file.getAbsolutePath() );
+            RecordManager recordManager = new RecordManager( file.getAbsolutePath() );
 
             IntSerializer ser = IntSerializer.INSTANCE;
             System.out.println( "Init" );
             System.out.println( "-----------------------------------------------------------" );
 
-            MavibotInspector.dumpInfos( rm, rm.getCurrentRecordManagerHeader() );
+            MavibotInspector.dumpInfos( recordManager, recordManager.getCurrentRecordManagerHeader() );
 
             System.out.println( "-----------------------------------------------------------" );
             System.out.println();
@@ -72,48 +73,78 @@
             // contains 1, 2, 3, 4, 5, 6, 7
             BTree<Integer, Integer> btree = null;
             
-            try ( WriteTransaction writeTxn = rm.beginWriteTransaction() )
+            WriteTransaction writeTxn = null;
+            
+            try
             {
-                btree = rm.addBTree( writeTxn, "master", IntSerializer.INSTANCE, IntSerializer.INSTANCE );
+                writeTxn = recordManager.beginWriteTransaction();
+                
+                btree = recordManager.addBTree( writeTxn, "master", IntSerializer.INSTANCE, IntSerializer.INSTANCE );
+
+                writeTxn.commit();
+            }
+            catch ( IOException ioe )
+            {
+                if ( writeTxn != null )
+                {
+                    writeTxn.abort();
+                }
             }
 
-            MavibotInspector.dumpInfos( rm, rm.getCurrentRecordManagerHeader() );
+            MavibotInspector.dumpInfos( recordManager, recordManager.getCurrentRecordManagerHeader() );
             
             System.out.println( "-----------------------------------------------------------" );
             System.out.println();
             System.out.println( "Inserting 7 values in master" );
             System.out.println( "-----------------------------------------------------------" );
             
-            try ( WriteTransaction writeTxn = rm.beginWriteTransaction() )
+            writeTxn = null;
+            
+            try
             {
+                writeTxn = recordManager.beginWriteTransaction();
+                
                 for ( Tuple<Integer, Integer> tuple : sortedTuple )
                 {
                     btree.insert( writeTxn, tuple.key, tuple.value );
                 }
                 
                 //btree = bb.build( writeTxn, sortedTuple.iterator() );
+
+                writeTxn.commit();
+            }
+            catch ( IOException ioe )
+            {
+                if ( writeTxn != null )
+                {
+                    writeTxn.abort();
+                }
             }
 
-            MavibotInspector.dumpInfos( rm, rm.getCurrentRecordManagerHeader() );
+            MavibotInspector.dumpInfos( recordManager, recordManager.getCurrentRecordManagerHeader() );
             
             System.out.println( "-----------------------------------------------------------" );
-            rm.close();
+            recordManager.close();
 
-            rm = new RecordManager( file.getAbsolutePath() );
+            recordManager = new RecordManager( file.getAbsolutePath() );
             
-            MavibotInspector.dumpInfos( rm, rm.getCurrentRecordManagerHeader() );
+            MavibotInspector.dumpInfos( recordManager, recordManager.getCurrentRecordManagerHeader() );
             
-            try ( Transaction txn = rm.beginReadTransaction() )
+            Transaction readTxn = null;
+            
+            try
             {
-                btree = rm.getBtree( txn, "master" );
+                readTxn = recordManager.beginReadTransaction();
+                
+                btree = recordManager.getBtree( readTxn, "master" );
     
                 assertEquals( 7, btree.getRootPage().getPageNbElems() );
     
-                assertEquals( 7, btree.getRootPage().findRightMost( txn ).getKey().intValue() );
+                assertEquals( 7, btree.getRootPage().findRightMost( readTxn ).getKey().intValue() );
     
-                assertEquals( 1, btree.getRootPage().findLeftMost( txn ).getKey().intValue() );
+                assertEquals( 1, btree.getRootPage().findLeftMost( readTxn ).getKey().intValue() );
     
-                TupleCursor<Integer, Integer> cursor = btree.browse( txn );
+                TupleCursor<Integer, Integer> cursor = btree.browse( readTxn );
                 int i = 0;
     
                 while ( cursor.hasNext() )
@@ -125,6 +156,15 @@
                 }
     
                 cursor.close();
+
+                readTxn.commit();
+            }
+            catch ( IOException ioe )
+            {
+                if ( readTxn != null )
+                {
+                    readTxn.abort();
+                }
             }
             
             btree.close();
diff --git a/mavibot/src/test/java/org/apache/directory/mavibot/btree/BTreeTransactionTest.java b/mavibot/src/test/java/org/apache/directory/mavibot/btree/BTreeTransactionTest.java
index b4b8fea..1efb39f 100644
--- a/mavibot/src/test/java/org/apache/directory/mavibot/btree/BTreeTransactionTest.java
+++ b/mavibot/src/test/java/org/apache/directory/mavibot/btree/BTreeTransactionTest.java
@@ -54,22 +54,28 @@
         dataDir = tempFolder.newFolder( UUID.randomUUID().toString() );
 
         openRecordManagerAndBtrees();
+        WriteTransaction writeTransaction = null;
         
         //recordManager.dump();
 
-        try ( WriteTransaction writeTransaction = recordManager.beginWriteTransaction() )
+        try
         {
+            writeTransaction = recordManager.beginWriteTransaction();
             // Create a new BTree with transaction and another one without
             btree = recordManager.addBTree( writeTransaction, "testWithTxn", LongSerializer.INSTANCE, StringSerializer.INSTANCE );
 
             //recordManager.dump();
+            writeTransaction.commit();
         }
         catch ( Exception e )
         {
-            throw new RuntimeException( e );
+            if ( writeTransaction != null ) 
+            {
+                writeTransaction.abort();
+            }
         }
 
-        recordManager.dump();
+        //recordManager.dump();
     }
 
 
@@ -100,13 +106,29 @@
             recordManager = new RecordManager( dataDir.getAbsolutePath(), 512, 1024 );
             
             System.out.println( "File : " + dataDir.getAbsolutePath() );
+            
+            recordManager.dump();
 
             // load the last created btree
             if ( btree != null )
             {
-                try ( Transaction readTransaction = recordManager.beginReadTransaction() )
+                
+                Transaction readTxn = null;
+                
+                try
                 {
-                    btree = recordManager.getBtree( readTransaction, btree.getName(), 0L );
+                    readTxn = recordManager.beginReadTransaction();
+                    
+                    btree = recordManager.getBtree( readTxn, btree.getName(), 0L );
+
+                    readTxn.commit();
+                }
+                catch ( IOException ioe )
+                {
+                    if ( readTxn != null )
+                    {
+                        readTxn.abort();
+                    }
                 }
             }
         }
@@ -120,22 +142,64 @@
     @Test
     public void testWithTransaction() throws IOException
     {
-        long nbPerLoop = 100L;
+        long nbPerLoop = 8L;
         long nbIteration = 10_000L / nbPerLoop;
         long t0 = System.currentTimeMillis();
 
         for ( long i = 0L; i < nbIteration; i++ )
         {
-            try ( WriteTransaction writeTransaction = recordManager.beginWriteTransaction() )
+            WriteTransaction writeTxn = null;
+            
+            try 
             {
+                writeTxn = recordManager.beginWriteTransaction();
+                
                 for ( int j = 0; j < nbPerLoop; j++ )
                 {
                     long key = i * nbPerLoop + j;
-                    btree.insert( writeTransaction, key , Long.toString( key ) );
+                    btree.insert( writeTxn, key , Long.toString( key ) );
+                }
+
+                writeTxn.commit();
+            }
+            catch ( IOException ioe )
+            {
+                if ( writeTxn != null )
+                {
+                    writeTxn.abort();
                 }
             }
+
+            Transaction readTxn = null;
             
-            recordManager.dump();
+            try
+            {
+                readTxn = recordManager.beginReadTransaction();
+                
+                TupleCursor<Long, String> cursor = btree.browse( readTxn );
+                
+                int nbElems = 0;
+                
+                while ( cursor.hasNext() )
+                {
+                    cursor.next();
+                    nbElems++;
+                    //System.out.print( nbElems + "/" );
+                }
+                
+                //System.out.println();
+
+                readTxn.commit();
+            }
+            catch ( IOException ioe )
+            {
+                if ( readTxn != null )
+                {
+                    readTxn.abort();
+                }
+            }
+
+            //recordManager.dump();
         }
 
         System.out.println( "File size : " + recordManager.fileChannel.size() );
@@ -171,13 +235,17 @@
                     e.printStackTrace();
                 }
                 
-                try ( Transaction readTransaction = recordManager.beginReadTransaction() )
+                Transaction readTxn = null;
+                
+                try
                 {
+                    readTxn = recordManager.beginReadTransaction();
+                    
                     //recordManager.dump( Thread.currentThread(), readTransaction.getRecordManagerHeader() );
-                    BTree<Long, String> btree = readTransaction.getBTree( "testWithTxn" );
+                    BTree<Long, String> btree = readTxn.getBTree( "testWithTxn" );
                     //System.out.println( btree.getBtreeHeader() );
 
-                    TupleCursor cursor = btree.browse( readTransaction );
+                    TupleCursor cursor = btree.browse( readTxn );
                     //System.out.println( "Nb elements to read (" + btree.getNbElems() + ")\n" );
                     
                     long nbElems = 0;
@@ -191,7 +259,7 @@
                     }
                     catch ( NullPointerException npe )
                     {
-                        cursor = btree.browse( readTransaction );
+                        cursor = btree.browse( readTxn );
                         nbElems = 0;
                         while ( cursor.hasNext() )
                         {
@@ -205,9 +273,21 @@
                     //System.out.println( "Thread[" + Thread.currentThread() + "], nRead " + nbElems + " nb elements (" + btree.getNbElems() + ")" );
                     cursor.close();
                 }
-                catch ( IOException e )
+                catch ( IOException ioe )
                 {
-                    e.printStackTrace();
+                    if ( readTxn != null )
+                    {
+                        try
+                        {
+                            readTxn.abort();
+                        }
+                        catch ( IOException ioe2 )
+                        {
+                            ioe2.printStackTrace();
+                        }
+                    }
+                    
+                    ioe.printStackTrace();
                 }
             }
         }
@@ -241,17 +321,30 @@
         
         for ( long i = 0L; i < nbIteration; i++ )
         {
-            try ( WriteTransaction writeTransaction = recordManager.beginWriteTransaction() )
+            WriteTransaction writeTxn = null;
+            
+            try
             {
+                writeTxn = recordManager.beginWriteTransaction();
+                
                 for ( int j = 0; j < nbPerLoop; j++ )
                 {
                     long key = i * nbPerLoop + j;
-                    BTree<Long, String> btree = writeTransaction.getBTree( "testWithTxn" );
+                    BTree<Long, String> btree = writeTxn.getBTree( "testWithTxn" );
 
-                    btree.insert( writeTransaction, key , Long.toString( key ) );
+                    btree.insert( writeTxn, key , Long.toString( key ) );
+                }
+
+                writeTxn.commit();
+            }
+            catch ( IOException ioe )
+            {
+                if ( writeTxn != null )
+                {
+                    writeTxn.abort();
                 }
             }
-            
+
             Thread.sleep(10);
             //recordManager.dump();
         }
@@ -261,13 +354,17 @@
 
         System.out.println( "Delta with transaction for " + nbElements  + " elements = " + ( t1 - t0 ) );
         
-        try ( Transaction readTransaction = recordManager.beginReadTransaction() )
+        Transaction readTxn = null;
+        
+        try
         {
+            readTxn = recordManager.beginReadTransaction();
+            
             //recordManager.dump( Thread.currentThread(), readTransaction.getRecordManagerHeader() );
-            BTree<Long, String> btree = readTransaction.getBTree( "testWithTxn" );
+            BTree<Long, String> btree = readTxn.getBTree( "testWithTxn" );
             System.out.println( btree.getBtreeHeader() );
 
-            TupleCursor cursor = btree.browse( readTransaction );
+            TupleCursor cursor = btree.browse( readTxn );
             
             long nbElems = 0;
             while ( cursor.hasNext() )
@@ -280,10 +377,17 @@
             
             System.out.println( "Read " + nbElems + " nb elements (" + btree.getNbElems() + ")" );
             cursor.close();
+
+            readTxn.commit();
         }
-        catch ( IOException e )
+        catch ( IOException ioe )
         {
-            e.printStackTrace();
+            if ( readTxn != null )
+            {
+                readTxn.abort();
+            }
+            
+            ioe.printStackTrace();
         }
 
         //Thread.sleep( 1000000L );
diff --git a/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerFreePageTest.java b/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerFreePageTest.java
index 1a65909..d017ae7 100644
--- a/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerFreePageTest.java
+++ b/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerFreePageTest.java
@@ -66,14 +66,23 @@
 
         openRecordManagerAndBtree();
 
-        try ( WriteTransaction writeTxn = recordManager1.beginWriteTransaction() )
+        WriteTransaction writeTxn = null;
+        
+        try
         {
+            writeTxn = recordManager1.beginWriteTransaction();
+            
             // Create a new BTree
             btree = recordManager1.addBTree( writeTxn, "test", LongSerializer.INSTANCE, StringSerializer.INSTANCE );
+
+            writeTxn.commit();
         }
-        catch ( Exception e )
+        catch ( Exception ioe )
         {
-            throw new RuntimeException( e );
+            if ( writeTxn != null )
+            {
+                writeTxn.abort();
+            }
         }
     }
 
@@ -109,9 +118,22 @@
             // load the last created btree
             if ( btree != null )
             {
-                try ( Transaction transaction = recordManager1.beginReadTransaction() )
+                Transaction readTxn = null;
+                
+                try
                 {
-                    btree = recordManager1.getBtree( transaction, btree.getName() );
+                    readTxn = recordManager1.beginReadTransaction();
+                    
+                    btree = recordManager1.getBtree( readTxn, btree.getName() );
+
+                    readTxn.commit();
+                }
+                catch ( IOException ioe )
+                {
+                    if ( readTxn != null )
+                    {
+                        readTxn.abort();
+                    }
                 }
             }
         }
@@ -149,9 +171,13 @@
             Long key = ( long ) i;
             String value = Long.toString( key );
 
-            try ( WriteTransaction writeTransaction = recordManager1.beginWriteTransaction() )
+            WriteTransaction writeTxn = null;
+            
+            try
             {
-                btree.insert( writeTransaction, key, value );
+                writeTxn = recordManager1.beginWriteTransaction();
+                
+                btree.insert( writeTxn, key, value );
     
                 if ( i % 10000 == 0 )
                 {
@@ -164,6 +190,15 @@
     
                     n++;
                 }
+
+                writeTxn.commit();
+            }
+            catch ( IOException ioe )
+            {
+                if ( writeTxn != null )
+                {
+                    writeTxn.abort();
+                }
             }
         }
 
@@ -198,9 +233,13 @@
         assertTrue( nbElems == btree.getNbElems() );
         long i = 0;
 
-        try ( Transaction transaction = recordManager1.beginReadTransaction() )
+        Transaction readTxn = null;
+        
+        try
         {
-            try ( TupleCursor<Long, String> cursor = btree.browse( transaction ) )
+            readTxn = recordManager1.beginReadTransaction();
+            
+            try ( TupleCursor<Long, String> cursor = btree.browse( readTxn ) )
             {
                 while ( cursor.hasNext() )
                 {
@@ -210,6 +249,15 @@
                     i++;
                 }
             }
+
+            readTxn.commit();
+        }
+        catch ( IOException ioe )
+        {
+            if ( readTxn != null )
+            {
+                readTxn.abort();
+            }
         }
 
         assertEquals( nbElems, i );
diff --git a/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerPrivateMethodTest.java b/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerPrivateMethodTest.java
index 2d40e39..cd992b8 100644
--- a/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerPrivateMethodTest.java
+++ b/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerPrivateMethodTest.java
@@ -65,9 +65,22 @@
         recordManager = new RecordManager( dataDir.getAbsolutePath(), 32, 1000 );
 
         // Create a new BTree
-        try ( WriteTransaction writeTransaction = recordManager.beginWriteTransaction() )
-        { 
-            btree = recordManager.addBTree( writeTransaction, "test", LongSerializer.INSTANCE, StringSerializer.INSTANCE );
+        WriteTransaction writeTxn = null;
+        
+        try
+        {
+            writeTxn = recordManager.beginWriteTransaction();
+            
+            btree = recordManager.addBTree( writeTxn, "test", LongSerializer.INSTANCE, StringSerializer.INSTANCE );
+
+            writeTxn.commit();
+        }
+        catch ( IOException ioe )
+        {
+            if ( writeTxn != null )
+            {
+                writeTxn.abort();
+            }
         }
     }
 
diff --git a/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerTest.java b/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerTest.java
index 1729937..a87a212 100644
--- a/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerTest.java
+++ b/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerTest.java
@@ -71,14 +71,23 @@
 
         openRecordManagerAndBtree();
 
-        try ( WriteTransaction writeTransaction = recordManager.beginWriteTransaction() )
+        WriteTransaction writeTxn = null; 
+        
+        try
         {
+            writeTxn = recordManager.beginWriteTransaction();
+            
             // Create a new BTree
-            btree = recordManager.addBTree( writeTransaction, "test", LongSerializer.INSTANCE, StringSerializer.INSTANCE );
+            btree = recordManager.addBTree( writeTxn, "test", LongSerializer.INSTANCE, StringSerializer.INSTANCE );
+
+            writeTxn.commit();
         }
-        catch ( Exception e )
+        catch ( Exception ioe )
         {
-            throw new RuntimeException( e );
+            if ( writeTxn != null )
+            {
+                writeTxn.abort();
+            }
         }
     }
 
@@ -112,9 +121,22 @@
             // load the last created btree
             if ( btree != null )
             {
-                try ( Transaction readTransaction = recordManager.beginReadTransaction() )
+                Transaction readTxn = null;
+                
+                try
                 {
-                    btree = recordManager.getBtree( readTransaction, btree.getName() );
+                    readTxn = recordManager.beginReadTransaction();
+                    
+                    btree = recordManager.getBtree( readTxn, btree.getName() );
+                    
+                    readTxn.commit();
+                }
+                catch ( IOException ioe )
+                {
+                    if ( readTxn != null )
+                    {
+                        readTxn.abort();
+                    }
                 }
             }
         }
@@ -138,9 +160,13 @@
         assertEquals( 1, managedBTrees.size() );
         assertTrue( managedBTrees.contains( "test" ) );
 
-        try ( Transaction readTransaction = recordManager.beginReadTransaction() )
+        Transaction readTxn = null;
+        
+        try
         {
-            BTree<Long, String> btree1 = recordManager.getBtree( readTransaction, "test" );
+            readTxn = recordManager.beginReadTransaction();
+            
+            BTree<Long, String> btree1 = recordManager.getBtree( readTxn, "test" );
     
             assertNotNull( btree1 );
             assertEquals( btree.getKeyComparator().getClass().getName(), btree1.getKeyComparator().getClass().getName() );
@@ -150,6 +176,15 @@
             assertEquals( btree.getBtreeInfo().getPageNbElem(), btree1.getBtreeInfo().getPageNbElem() );
             assertEquals( btree.getBtreeHeader().getRevision(), btree1.getBtreeHeader().getRevision() );
             assertEquals( btree.getValueSerializer().getClass().getName(), btree1.getValueSerializer().getClass().getName() );
+            
+            readTxn.commit();
+        }
+        catch ( IOException ioe )
+        {
+            if ( readTxn != null )
+            {
+                readTxn.abort();
+            }
         }
     }
 
@@ -161,17 +196,43 @@
     public void testRecordManagerWithBTree() throws IOException, BTreeAlreadyManagedException, KeyNotFoundException
     {
         // Now, add some elements in the BTree
-        try ( WriteTransaction writeTransaction = recordManager.beginWriteTransaction() )
+        WriteTransaction writeTxn = null; 
+        
+        try
         {
-            btree.insert( writeTransaction, 3L, "V3" );
-            btree.insert( writeTransaction, 1L, "V1" );
-            btree.insert( writeTransaction, 5L, "V5" );
+            writeTxn = recordManager.beginWriteTransaction();
+            
+            btree.insert( writeTxn, 3L, "V3" );
+            btree.insert( writeTxn, 1L, "V1" );
+            btree.insert( writeTxn, 5L, "V5" );
+
+            writeTxn.commit();
+        }
+        catch ( IOException ioe )
+        {
+            if ( writeTxn != null )
+            {
+                writeTxn.abort();
+            }
         }
 
-        try ( WriteTransaction writeTransaction = recordManager.beginWriteTransaction() )
+        writeTxn = null; 
+        
+        try
         {
-            btree.insert( writeTransaction, 4L, "V4" );
-            btree.insert( writeTransaction, 2L, "V2" );
+            writeTxn = recordManager.beginWriteTransaction();
+            
+            btree.insert( writeTxn, 4L, "V4" );
+            btree.insert( writeTxn, 2L, "V2" );
+
+            writeTxn.commit();
+        }
+        catch ( IOException ioe )
+        {
+            if ( writeTxn != null )
+            {
+                writeTxn.abort();
+            }
         }
 
         // Now, try to reload the file back
@@ -184,9 +245,13 @@
         assertEquals( 1, managedBTrees.size() );
         assertTrue( managedBTrees.contains( "test" ) );
         
-        try ( Transaction transaction = recordManager.beginReadTransaction() )
+        Transaction readTxn = null;
+        
+        try
         {
-            BTree<Long, String> btree1 = recordManager.getBtree( transaction,  "test" );
+            readTxn = recordManager.beginReadTransaction();
+            
+            BTree<Long, String> btree1 = recordManager.getBtree( readTxn,  "test" );
     
             assertNotNull( btree1 );
             assertEquals( btree.getKeyComparator().getClass().getName(), btree1.getKeyComparator().getClass().getName() );
@@ -200,8 +265,17 @@
             // Check the stored element
             for ( long i = 1L; i < 6L; i++ )
             {
-                assertTrue( btree1.hasKey( transaction, i ) );
-                assertEquals( "V" + i, btree1.get( transaction, i ) );
+                assertTrue( btree1.hasKey( readTxn, i ) );
+                assertEquals( "V" + i, btree1.get( readTxn, i ) );
+            }
+            
+            readTxn.commit();
+        }
+        catch ( IOException ioe )
+        {
+            if ( readTxn != null )
+            {
+                readTxn.abort();
             }
         }
     }
@@ -217,22 +291,48 @@
         // Now, add some elements in the BTree
         for ( long i = 1L; i < 32L; i++ )
         {
-            try ( WriteTransaction writeTransaction = recordManager.beginWriteTransaction() )
+            WriteTransaction writeTxn = null; 
+            
+            try
             {
-                btree.insert( writeTransaction, i, "V" + i );
+                writeTxn = recordManager.beginWriteTransaction();
+                
+                btree.insert( writeTxn, i, "V" + i );
+
+                writeTxn.commit();
+            }
+            catch ( IOException ioe )
+            {
+                if ( writeTxn != null )
+                {
+                    writeTxn.abort();
+                }
             }
         }
 
         for ( long i = 1L; i < 32L; i++ )
         {
-            try ( Transaction transaction = recordManager.beginReadTransaction() )
+            Transaction readTxn = null;
+            
+            try
             {
-                if ( !btree.hasKey( transaction, i ) )
+                readTxn = recordManager.beginReadTransaction();
+                
+                if ( !btree.hasKey( readTxn, i ) )
                 {
                     System.out.println( "Not found !!! " + i );
                 }
-                assertTrue( btree.hasKey( transaction, i ) );
-                assertEquals( "V" + i, btree.get( transaction, i ) );
+                assertTrue( btree.hasKey( readTxn, i ) );
+                assertEquals( "V" + i, btree.get( readTxn, i ) );
+                
+                readTxn.commit();
+            }
+            catch ( IOException ioe )
+            {
+                if ( readTxn != null )
+                {
+                    readTxn.abort();
+                }
             }
         }
 
@@ -246,9 +346,13 @@
         assertEquals( 1, managedBTrees.size() );
         assertTrue( managedBTrees.contains( "test" ) );
 
-        try ( Transaction transaction = recordManager.beginReadTransaction() )
+        Transaction readTxn = null;
+        
+        try
         {
-            BTree<Long, String> btree1 = recordManager.getBtree( transaction, "test" );
+            readTxn = recordManager.beginReadTransaction();
+            
+            BTree<Long, String> btree1 = recordManager.getBtree( readTxn, "test" );
 
             assertNotNull( btree1 );
             assertEquals( btree.getKeyComparator().getClass().getName(), btree1.getKeyComparator().getClass().getName() );
@@ -262,12 +366,21 @@
             // Check the stored element
             for ( long i = 1L; i < 32L; i++ )
             {
-                if ( !btree1.hasKey( transaction, i ) )
+                if ( !btree1.hasKey( readTxn, i ) )
                 {
                     System.out.println( "Not found " + i );
                 }
-                assertTrue( btree1.hasKey( transaction, i ) );
-                assertEquals( "V" + i, btree1.get( transaction, i ) );
+                assertTrue( btree1.hasKey( readTxn, i ) );
+                assertEquals( "V" + i, btree1.get( readTxn, i ) );
+            }
+            
+            readTxn.commit();
+        }
+        catch ( IOException ioe )
+        {
+            if ( readTxn != null )
+            {
+                readTxn.abort();
             }
         }
     }
@@ -297,9 +410,22 @@
         {
             String value = "V" + i;
             
-            try ( WriteTransaction writeTransaction = recordManager.beginWriteTransaction() )
+            WriteTransaction writeTxn = null; 
+            
+            try
             {
-                btree.insert( writeTransaction, i, value );
+                writeTxn = recordManager.beginWriteTransaction();
+                
+                btree.insert( writeTxn, i, value );
+
+                writeTxn.commit();
+            }
+            catch ( IOException ioe )
+            {
+                if ( writeTxn != null )
+                {
+                    writeTxn.abort();
+                }
             }
 
             /*
@@ -339,9 +465,13 @@
         assertEquals( 1, managedBTrees.size() );
         assertTrue( managedBTrees.contains( "test" ) );
 
-        try ( Transaction transaction = recordManager.beginReadTransaction() )
+        Transaction readTxn = null;
+        
+        try
         {
-            BTree<Long, String> btree1 = recordManager.getBtree( transaction, "test" );
+            readTxn = recordManager.beginReadTransaction();
+            
+            BTree<Long, String> btree1 = recordManager.getBtree( readTxn, "test" );
     
             assertNotNull( btree1 );
             assertEquals( btree.getKeyComparator().getClass().getName(), btree1.getKeyComparator().getClass().getName() );
@@ -357,7 +487,7 @@
             for ( long i = 0L; i < nbElems; i++ )
             {
                 //assertTrue( btree1.exist( i ) );
-                assertEquals( "V" + i, btree1.get( transaction, i ) );
+                assertEquals( "V" + i, btree1.get( readTxn, i ) );
             }
             long t3 = System.currentTimeMillis();
             System.out.println( "Time taken to verify 100 000 elements : " + ( t3 - t2 ) );
@@ -367,21 +497,33 @@
             for ( long i = 0L; i < nbElems; i++ )
             {
                 //assertTrue( btree1.exist( i ) );
-                assertEquals( "V" + i, btree1.get( transaction, i ) );
+                assertEquals( "V" + i, btree1.get( readTxn, i ) );
             }
             long t5 = System.currentTimeMillis();
             System.out.println( "Time taken to verify 100 000 elements : " + ( t5 - t4 ) );
+            
+            readTxn.commit();
+        }
+        catch ( IOException ioe )
+        {
+            if ( readTxn != null )
+            {
+                readTxn.abort();
+            }
         }
     }
 
 
     private void checkBTreeRevisionBrowse( BTree<Long, String> btree, long revision, long... values )
-        throws IOException,
-        KeyNotFoundException, CursorException
+        throws IOException, KeyNotFoundException, CursorException
     {
-        try ( Transaction transaction = recordManager.beginReadTransaction() )
+        Transaction readTxn = null;
+        
+        try
         {
-            TupleCursor<Long, String> cursor = btree.browse( transaction );
+            readTxn = recordManager.beginReadTransaction();
+            
+            TupleCursor<Long, String> cursor = btree.browse( readTxn );
             List<Long> expected = new ArrayList<Long>( values.length );
             Set<Long> found = new HashSet<Long>( values.length );
     
@@ -406,17 +548,29 @@
     
             assertEquals( values.length, nb );
             cursor.close();
+            
+            readTxn.commit();
+        }
+        catch ( IOException ioe )
+        {
+            if ( readTxn != null )
+            {
+                readTxn.abort();
+            }
         }
     }
 
 
     private void checkBTreeRevisionBrowseFrom( BTree<Long, String> btree, long revision, long from, long... values )
-        throws IOException,
-        KeyNotFoundException
+        throws IOException, KeyNotFoundException
     {
-        try ( Transaction transaction = recordManager.beginReadTransaction() )
+        Transaction readTxn = null;
+        
+        try
         {
-            TupleCursor<Long, String> cursor = btree.browseFrom( transaction, from );
+            readTxn = recordManager.beginReadTransaction();
+            
+            TupleCursor<Long, String> cursor = btree.browseFrom( readTxn, from );
             List<Long> expected = new ArrayList<Long>( values.length );
             Set<Long> found = new HashSet<Long>( values.length );
     
@@ -441,6 +595,15 @@
     
             assertEquals( values.length, nb );
             cursor.close();
+            
+            readTxn.commit();
+        }
+        catch ( IOException ioe )
+        {
+            if ( readTxn != null )
+            {
+                readTxn.abort();
+            }
         }
     }
 
@@ -448,10 +611,23 @@
     @Test
     public void testAdds() throws IOException, BTreeAlreadyManagedException, KeyNotFoundException
     {
-        try ( WriteTransaction writeTransaction = recordManager.beginWriteTransaction() )
+        WriteTransaction writeTxn = null; 
+        
+        try
         {
-            btree.insert( writeTransaction, 1L, "V1" );
-            btree.insert( writeTransaction, 2L, "V2" );
+            writeTxn = recordManager.beginWriteTransaction();
+            
+            btree.insert( writeTxn, 1L, "V1" );
+            btree.insert( writeTxn, 2L, "V2" );
+
+            writeTxn.commit();
+        }
+        catch ( IOException ioe )
+        {
+            if ( writeTxn != null )
+            {
+                writeTxn.abort();
+            }
         }
     }
 
@@ -469,8 +645,12 @@
 
         System.out.println( "Test start" );
         */
-        try ( WriteTransaction writeTransaction = recordManager.beginWriteTransaction() )
+        WriteTransaction writeTxn = null; 
+            
+        try
         {
+            writeTxn = recordManager.beginWriteTransaction();
+            
             /*
             System.out.println( "Before V1" );
             for ( Long key : recordManager.writeCounter.keySet() )
@@ -479,7 +659,7 @@
                     + " times" );
             }
             */
-            btree.insert( writeTransaction, 1L, "V1" );
+            btree.insert( writeTxn, 1L, "V1" );
             /*
             for ( Long key : recordManager.writeCounter.keySet() )
             {
@@ -491,11 +671,11 @@
             */
     
             //System.out.println( "Before V2" );
-            btree.insert( writeTransaction, 2L, "V2" );
+            btree.insert( writeTxn, 2L, "V2" );
             //System.out.println( "After V2" );
     
             //System.out.println( "Before V3" );
-            btree.insert( writeTransaction, 3L, "V3" );
+            btree.insert( writeTxn, 3L, "V3" );
             /*
             for ( Long key : recordManager.writeCounter.keySet() )
             {
@@ -503,6 +683,15 @@
                     + " times" );
             }
             */
+            
+            writeTxn.commit();
+        }
+        catch ( IOException ioe )
+        {
+            if ( writeTxn != null )
+            {
+                writeTxn.abort();
+            }
         }
 
         /*