directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r943719 - in /directory/apacheds/trunk: i18n/src/main/java/org/apache/directory/server/i18n/ i18n/src/main/resources/org/apache/directory/server/i18n/ jdbm/src/main/java/jdbm/btree/ jdbm/src/main/java/jdbm/helper/ jdbm/src/main/java/jdbm/re...
Date Wed, 12 May 2010 22:17:36 GMT
Author: elecharny
Date: Wed May 12 22:17:35 2010
New Revision: 943719

URL: http://svn.apache.org/viewvc?rev=943719&view=rev
Log:
Reformating

Modified:
    directory/apacheds/trunk/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java
    directory/apacheds/trunk/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties
    directory/apacheds/trunk/jdbm/src/main/java/jdbm/btree/BPage.java
    directory/apacheds/trunk/jdbm/src/main/java/jdbm/btree/BTree.java
    directory/apacheds/trunk/jdbm/src/main/java/jdbm/helper/MRU.java
    directory/apacheds/trunk/jdbm/src/main/java/jdbm/helper/Serialization.java
    directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/BaseRecordManager.java
    directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/BlockIo.java
    directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/CacheRecordManager.java
    directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/FreeLogicalRowIdPageManager.java
    directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/FreePhysicalRowIdPageManager.java
    directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/LogicalRowIdManager.java
    directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/PageManager.java
    directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/PhysicalRowIdManager.java

Modified: directory/apacheds/trunk/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java?rev=943719&r1=943718&r2=943719&view=diff
==============================================================================
--- directory/apacheds/trunk/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java (original)
+++ directory/apacheds/trunk/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java Wed May 12 22:17:35 2010
@@ -577,7 +577,7 @@ public class I18n
     public static String ERR_536 = "ERR_536";
     public static String ERR_537 = "ERR_537";
     public static String ERR_538 = "ERR_538";
-    public static String ERR_539 = "ERR_539";
+    public static String ERR_539_BAD_BLOCK_ID = "ERR_539_BAD_BLOCK_ID";
     public static String ERR_540 = "ERR_540";
     public static String ERR_541 = "ERR_541";
     public static String ERR_542 = "ERR_542";

Modified: directory/apacheds/trunk/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties?rev=943719&r1=943718&r2=943719&view=diff
==============================================================================
--- directory/apacheds/trunk/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties (original)
+++ directory/apacheds/trunk/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties Wed May 12 22:17:35 2010
@@ -560,7 +560,7 @@ ERR_535=Cannot create deeper directory. 
 ERR_536=Argument 'recid' is invalid: {0}
 ERR_537=Name directory must exist
 ERR_538=RecordManager has been closed
-ERR_539=bogus block id {0}
+ERR_539_BAD_BLOCK_ID=bogus block id {0}, it should not be negative
 ERR_540=BlockId assigned for transaction block
 ERR_541=transaction count on block {0} below zero!
 ERR_542=Argument 'cache' is null

Modified: directory/apacheds/trunk/jdbm/src/main/java/jdbm/btree/BPage.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm/src/main/java/jdbm/btree/BPage.java?rev=943719&r1=943718&r2=943719&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm/src/main/java/jdbm/btree/BPage.java (original)
+++ directory/apacheds/trunk/jdbm/src/main/java/jdbm/btree/BPage.java Wed May 12 22:17:35 2010
@@ -85,15 +85,13 @@ public final class BPage implements Seri
 
     private static final boolean DEBUG = false;
 
-    /**
-     * Version id for serialization.
-     */
+    /** Version id for serialization. */
     final static long serialVersionUID = 1L;
 
     /**
      * Parent B+Tree.
      */
-    transient BTree _btree;
+    transient BTree btree;
 
     /**
      * This BPage's record ID in the PageManager.
@@ -103,7 +101,7 @@ public final class BPage implements Seri
     /**
      * Flag indicating if this is a leaf BPage.
      */
-    protected boolean _isLeaf;
+    protected boolean isLeaf;
 
     /**
      * Keys of children nodes
@@ -115,24 +113,16 @@ public final class BPage implements Seri
      */
     protected Object[] _values;
 
-    /**
-     * Children pages (recids) associated with keys.  (Only valid if non-leaf BPage)
-     */
-    protected long[] _children;
+    /** Children pages (recids) associated with keys.  (Only valid if non-leaf BPage) */
+    protected long[] children;
 
-    /**
-     * Index of first used item at the page
-     */
+    /** Index of first used item at the page */
     protected int _first;
 
-    /**
-     * Previous leaf BPage (only if this BPage is a leaf)
-     */
+    /** Previous leaf BPage (only if this BPage is a leaf) */
     protected long _previous;
 
-    /**
-     * Next leaf BPage (only if this BPage is a leaf)
-     */
+    /** Next leaf BPage (only if this BPage is a leaf) */
     protected long _next;
 
 
@@ -150,21 +140,21 @@ public final class BPage implements Seri
      */
     BPage( BTree btree, BPage root, BPage overflow ) throws IOException
     {
-        _btree = btree;
+        this.btree = btree;
 
-        _isLeaf = false;
+        isLeaf = false;
 
-        _first = _btree._pageSize - 2;
+        _first = btree.pageSize - 2;
 
-        _keys = new Object[_btree._pageSize];
-        _keys[_btree._pageSize - 2] = overflow.getLargestKey();
-        _keys[_btree._pageSize - 1] = root.getLargestKey();
+        _keys = new Object[btree.pageSize];
+        _keys[btree.pageSize - 2] = overflow.getLargestKey();
+        _keys[btree.pageSize - 1] = root.getLargestKey();
 
-        _children = new long[_btree._pageSize];
-        _children[_btree._pageSize - 2] = overflow._recid;
-        _children[_btree._pageSize - 1] = root._recid;
+        children = new long[btree.pageSize];
+        children[btree.pageSize - 2] = overflow._recid;
+        children[btree.pageSize - 1] = root._recid;
 
-        _recid = _btree._recman.insert( this, this );
+        _recid = btree.recordManager.insert( this, this );
     }
 
 
@@ -173,21 +163,21 @@ public final class BPage implements Seri
      */
     BPage( BTree btree, Object key, Object value ) throws IOException
     {
-        _btree = btree;
+        this.btree = btree;
 
-        _isLeaf = true;
+        isLeaf = true;
 
-        _first = btree._pageSize - 2;
+        _first = btree.pageSize - 2;
 
-        _keys = new Object[_btree._pageSize];
-        _keys[_btree._pageSize - 2] = key;
-        _keys[_btree._pageSize - 1] = null; // I am the root BPage for now
+        _keys = new Object[btree.pageSize];
+        _keys[btree.pageSize - 2] = key;
+        _keys[btree.pageSize - 1] = null; // I am the root BPage for now
 
-        _values = new Object[_btree._pageSize];
-        _values[_btree._pageSize - 2] = value;
-        _values[_btree._pageSize - 1] = null; // I am the root BPage for now
+        _values = new Object[btree.pageSize];
+        _values[btree.pageSize - 2] = value;
+        _values[btree.pageSize - 1] = null; // I am the root BPage for now
 
-        _recid = _btree._recman.insert( this, this );
+        _recid = btree.recordManager.insert( this, this );
     }
 
 
@@ -196,24 +186,24 @@ public final class BPage implements Seri
      */
     BPage( BTree btree, boolean isLeaf ) throws IOException
     {
-        _btree = btree;
+        this.btree = btree;
 
-        _isLeaf = isLeaf;
+        this.isLeaf = isLeaf;
 
         // page will initially be half-full
-        _first = _btree._pageSize / 2;
+        _first = btree.pageSize / 2;
 
-        _keys = new Object[_btree._pageSize];
+        _keys = new Object[btree.pageSize];
         if ( isLeaf )
         {
-            _values = new Object[_btree._pageSize];
+            _values = new Object[btree.pageSize];
         }
         else
         {
-            _children = new long[_btree._pageSize];
+            children = new long[btree.pageSize];
         }
 
-        _recid = _btree._recman.insert( this, this );
+        _recid = btree.recordManager.insert( this, this );
     }
 
 
@@ -223,7 +213,7 @@ public final class BPage implements Seri
      */
     Object getLargestKey()
     {
-        return _keys[_btree._pageSize - 1];
+        return _keys[btree.pageSize - 1];
     }
 
 
@@ -232,13 +222,13 @@ public final class BPage implements Seri
      */
     boolean isEmpty()
     {
-        if ( _isLeaf )
+        if ( isLeaf )
         {
             return ( _first == _values.length - 1 );
         }
         else
         {
-            return ( _first == _children.length - 1 );
+            return ( _first == children.length - 1 );
         }
     }
 
@@ -294,7 +284,7 @@ public final class BPage implements Seri
      */
     TupleBrowser findFirst() throws IOException
     {
-        if ( _isLeaf )
+        if ( isLeaf )
         {
             return new Browser( this, _first );
         }
@@ -350,7 +340,7 @@ public final class BPage implements Seri
                 if ( replace )
                 {
                     _values[index] = value;
-                    _btree._recman.update( _recid, this, this );
+                    btree.recordManager.update( _recid, this, this );
                 }
                 // return the existing key
                 return result;
@@ -391,7 +381,7 @@ public final class BPage implements Seri
         }
 
         // if we get here, we need to insert a new entry on the BPage
-        // before _children[ index ]
+        // before children[ index ]
         if ( !isFull() )
         {
             if ( height == 0 )
@@ -402,13 +392,13 @@ public final class BPage implements Seri
             {
                 insertChild( this, index - 1, key, overflow );
             }
-            _btree._recman.update( _recid, this, this );
+            btree.recordManager.update( _recid, this, this );
             return result;
         }
 
         // page is full, we must divide the page
-        int half = _btree._pageSize >> 1;
-        BPage newPage = new BPage( _btree, _isLeaf );
+        int half = btree.pageSize >> 1;
+        BPage newPage = new BPage( btree, isLeaf );
         if ( index < half )
         {
             // move lower-half of entries to overflow BPage,
@@ -468,7 +458,7 @@ public final class BPage implements Seri
             }
         }
 
-        if ( _isLeaf )
+        if ( isLeaf )
         {
             // link newly created BPage
             newPage._previous = _previous;
@@ -477,13 +467,13 @@ public final class BPage implements Seri
             {
                 BPage previous = loadBPage( _previous );
                 previous._next = newPage._recid;
-                _btree._recman.update( _previous, previous, this );
+                btree.recordManager.update( _previous, previous, this );
             }
             _previous = newPage._recid;
         }
 
-        _btree._recman.update( _recid, this, this );
-        _btree._recman.update( newPage._recid, newPage, this );
+        btree.recordManager.update( _recid, this, this );
+        btree.recordManager.update( newPage._recid, newPage, this );
 
         result._overflow = newPage;
         return result;
@@ -501,7 +491,7 @@ public final class BPage implements Seri
     {
         RemoveResult result;
 
-        int half = _btree._pageSize / 2;
+        int half = btree.pageSize / 2;
         int index = findChildren( key );
 
         height -= 1;
@@ -517,7 +507,7 @@ public final class BPage implements Seri
             removeEntry( this, index );
 
             // update this BPage
-            _btree._recman.update( _recid, this, this );
+            btree.recordManager.update( _recid, this, this );
 
         }
         else
@@ -528,7 +518,7 @@ public final class BPage implements Seri
 
             // update children
             _keys[index] = child.getLargestKey();
-            _btree._recman.update( _recid, this, this );
+            btree.recordManager.update( _recid, this, this );
 
             if ( result._underflow )
             {
@@ -537,7 +527,7 @@ public final class BPage implements Seri
                 {
                     throw new IllegalStateException( I18n.err( I18n.ERR_513, "1" ) );
                 }
-                if ( index < _children.length - 1 )
+                if ( index < children.length - 1 )
                 {
                     // exists greater brother page
                     BPage brother = childBPage( index + 1 );
@@ -548,7 +538,7 @@ public final class BPage implements Seri
                         int steal = ( half - bfirst + 1 ) / 2;
                         brother._first += steal;
                         child._first -= steal;
-                        if ( child._isLeaf )
+                        if ( child.isLeaf )
                         {
                             copyEntries( child, half + 1, child, half + 1 - steal, half - 1 );
                             copyEntries( brother, bfirst, child, 2 * half - steal, steal );
@@ -561,7 +551,7 @@ public final class BPage implements Seri
 
                         for ( int i = bfirst; i < bfirst + steal; i++ )
                         {
-                            if ( brother._isLeaf )
+                            if ( brother.isLeaf )
                             {
                                 setEntry( brother, i, null, null );
                             }
@@ -577,9 +567,9 @@ public final class BPage implements Seri
                         // no change in previous/next BPage
 
                         // update BPages
-                        _btree._recman.update( _recid, this, this );
-                        _btree._recman.update( brother._recid, brother, this );
-                        _btree._recman.update( child._recid, child, this );
+                        btree.recordManager.update( _recid, this, this );
+                        btree.recordManager.update( brother._recid, brother, this );
+                        btree.recordManager.update( child._recid, child, this );
 
                     }
                     else
@@ -591,7 +581,7 @@ public final class BPage implements Seri
                         }
 
                         brother._first = 1;
-                        if ( child._isLeaf )
+                        if ( child.isLeaf )
                         {
                             copyEntries( child, half + 1, brother, 1, half - 1 );
                         }
@@ -599,10 +589,10 @@ public final class BPage implements Seri
                         {
                             copyChildren( child, half + 1, brother, 1, half - 1 );
                         }
-                        _btree._recman.update( brother._recid, brother, this );
+                        btree.recordManager.update( brother._recid, brother, this );
 
                         // remove "child" from current BPage
-                        if ( _isLeaf )
+                        if ( isLeaf )
                         {
                             copyEntries( this, _first, this, _first + 1, index - _first );
                             setEntry( this, _first, null, null );
@@ -613,24 +603,24 @@ public final class BPage implements Seri
                             setChild( this, _first, null, -1 );
                         }
                         _first += 1;
-                        _btree._recman.update( _recid, this, this );
+                        btree.recordManager.update( _recid, this, this );
 
                         // re-link previous and next BPages
                         if ( child._previous != 0 )
                         {
                             BPage prev = loadBPage( child._previous );
                             prev._next = child._next;
-                            _btree._recman.update( prev._recid, prev, this );
+                            btree.recordManager.update( prev._recid, prev, this );
                         }
                         if ( child._next != 0 )
                         {
                             BPage next = loadBPage( child._next );
                             next._previous = child._previous;
-                            _btree._recman.update( next._recid, next, this );
+                            btree.recordManager.update( next._recid, next, this );
                         }
 
                         // delete "child" BPage
-                        _btree._recman.delete( child._recid );
+                        btree.recordManager.delete( child._recid );
                     }
                 }
                 else
@@ -644,7 +634,7 @@ public final class BPage implements Seri
                         int steal = ( half - bfirst + 1 ) / 2;
                         brother._first += steal;
                         child._first -= steal;
-                        if ( child._isLeaf )
+                        if ( child.isLeaf )
                         {
                             copyEntries( brother, 2 * half - steal, child, half + 1 - steal, steal );
                             copyEntries( brother, bfirst, brother, bfirst + steal, 2 * half - bfirst - steal );
@@ -657,7 +647,7 @@ public final class BPage implements Seri
 
                         for ( int i = bfirst; i < bfirst + steal; i++ )
                         {
-                            if ( brother._isLeaf )
+                            if ( brother.isLeaf )
                             {
                                 setEntry( brother, i, null, null );
                             }
@@ -673,9 +663,9 @@ public final class BPage implements Seri
                         // no change in previous/next BPage
 
                         // update BPages
-                        _btree._recman.update( _recid, this, this );
-                        _btree._recman.update( brother._recid, brother, this );
-                        _btree._recman.update( child._recid, child, this );
+                        btree.recordManager.update( _recid, this, this );
+                        btree.recordManager.update( brother._recid, brother, this );
+                        btree.recordManager.update( child._recid, child, this );
 
                     }
                     else
@@ -687,7 +677,7 @@ public final class BPage implements Seri
                         }
 
                         child._first = 1;
-                        if ( child._isLeaf )
+                        if ( child.isLeaf )
                         {
                             copyEntries( brother, half, child, 1, half );
                         }
@@ -695,10 +685,10 @@ public final class BPage implements Seri
                         {
                             copyChildren( brother, half, child, 1, half );
                         }
-                        _btree._recman.update( child._recid, child, this );
+                        btree.recordManager.update( child._recid, child, this );
 
                         // remove "brother" from current BPage
-                        if ( _isLeaf )
+                        if ( isLeaf )
                         {
                             copyEntries( this, _first, this, _first + 1, index - 1 - _first );
                             setEntry( this, _first, null, null );
@@ -709,24 +699,24 @@ public final class BPage implements Seri
                             setChild( this, _first, null, -1 );
                         }
                         _first += 1;
-                        _btree._recman.update( _recid, this, this );
+                        btree.recordManager.update( _recid, this, this );
 
                         // re-link previous and next BPages
                         if ( brother._previous != 0 )
                         {
                             BPage prev = loadBPage( brother._previous );
                             prev._next = brother._next;
-                            _btree._recman.update( prev._recid, prev, this );
+                            btree.recordManager.update( prev._recid, prev, this );
                         }
                         if ( brother._next != 0 )
                         {
                             BPage next = loadBPage( brother._next );
                             next._previous = brother._previous;
-                            _btree._recman.update( next._recid, next, this );
+                            btree.recordManager.update( next._recid, next, this );
                         }
 
                         // delete "brother" BPage
-                        _btree._recman.delete( brother._recid );
+                        btree.recordManager.delete( brother._recid );
                     }
                 }
             }
@@ -748,7 +738,7 @@ public final class BPage implements Seri
     private int findChildren( Object key )
     {
         int left = _first;
-        int right = _btree._pageSize - 1;
+        int right = btree.pageSize - 1;
 
         // binary search
         while ( left < right )
@@ -792,7 +782,7 @@ public final class BPage implements Seri
     private static void insertChild( BPage page, int index, Object key, long child )
     {
         Object[] keys = page._keys;
-        long[] children = page._children;
+        long[] children = page.children;
         int start = page._first;
         int count = index - page._first + 1;
 
@@ -858,7 +848,7 @@ public final class BPage implements Seri
     private static void setChild( BPage page, int index, Object key, long recid )
     {
         page._keys[index] = key;
-        page._children[index] = recid;
+        page.children[index] = recid;
     }
 
 
@@ -878,7 +868,7 @@ public final class BPage implements Seri
     private static void copyChildren( BPage source, int indexSource, BPage dest, int indexDest, int count )
     {
         System.arraycopy( source._keys, indexSource, dest._keys, indexDest, count );
-        System.arraycopy( source._children, indexSource, dest._children, indexDest, count );
+        System.arraycopy( source.children, indexSource, dest.children, indexDest, count );
     }
 
 
@@ -887,7 +877,7 @@ public final class BPage implements Seri
      */
     BPage childBPage( int index ) throws IOException
     {
-        return loadBPage( _children[index] );
+        return loadBPage( children[index] );
     }
 
 
@@ -896,9 +886,9 @@ public final class BPage implements Seri
      */
     private BPage loadBPage( long recid ) throws IOException
     {
-        BPage child = ( BPage ) _btree._recman.fetch( recid, this );
+        BPage child = ( BPage ) btree.recordManager.fetch( recid, this );
         child._recid = recid;
-        child._btree = _btree;
+        child.btree = btree;
         return child;
     }
 
@@ -913,7 +903,7 @@ public final class BPage implements Seri
         {
             return -1;
         }
-        return _btree._comparator.compare( value1, value2 );
+        return btree.comparator.compare( value1, value2 );
     }
 
 
@@ -957,15 +947,15 @@ public final class BPage implements Seri
         }
         System.out.println( prefix + "-------------------------------------- BPage recid=" + _recid );
         System.out.println( prefix + "first=" + _first );
-        for ( int i = 0; i < _btree._pageSize; i++ )
+        for ( int i = 0; i < btree.pageSize; i++ )
         {
-            if ( _isLeaf )
+            if ( isLeaf )
             {
                 System.out.println( prefix + "BPage [" + i + "] " + _keys[i] + " " + _values[i] );
             }
             else
             {
-                System.out.println( prefix + "BPage [" + i + "] " + _keys[i] + " " + _children[i] );
+                System.out.println( prefix + "BPage [" + i + "] " + _keys[i] + " " + children[i] );
             }
         }
         System.out.println( prefix + "--------------------------------------" );
@@ -982,7 +972,7 @@ public final class BPage implements Seri
         level += 1;
         if ( height > 0 )
         {
-            for ( int i = _first; i < _btree._pageSize; i++ )
+            for ( int i = _first; i < btree.pageSize; i++ )
             {
                 if ( _keys[i] == null )
                     break;
@@ -1000,7 +990,7 @@ public final class BPage implements Seri
      */
     private void assertConsistency()
     {
-        for ( int i = _first; i < _btree._pageSize - 1; i++ )
+        for ( int i = _first; i < btree.pageSize - 1; i++ )
         {
             if ( compare( ( byte[] ) _keys[i], ( byte[] ) _keys[i + 1] ) >= 0 )
             {
@@ -1020,7 +1010,7 @@ public final class BPage implements Seri
         assertConsistency();
         if ( --height > 0 )
         {
-            for ( int i = _first; i < _btree._pageSize; i++ )
+            for ( int i = _first; i < btree.pageSize; i++ )
             {
                 if ( _keys[i] == null )
                     break;
@@ -1054,8 +1044,8 @@ public final class BPage implements Seri
         bais = new ByteArrayInputStream( serialized );
         ois = new ObjectInputStream( bais );
 
-        bpage._isLeaf = ois.readBoolean();
-        if ( bpage._isLeaf )
+        bpage.isLeaf = ois.readBoolean();
+        if ( bpage.isLeaf )
         {
             bpage._previous = ois.readLong();
             bpage._next = ois.readLong();
@@ -1063,12 +1053,12 @@ public final class BPage implements Seri
 
         bpage._first = ois.readInt();
 
-        bpage._keys = new Object[_btree._pageSize];
+        bpage._keys = new Object[btree.pageSize];
         try
         {
-            for ( int i = bpage._first; i < _btree._pageSize; i++ )
+            for ( int i = bpage._first; i < btree.pageSize; i++ )
             {
-                if ( _btree._keySerializer == null )
+                if ( btree.keySerializer == null )
                 {
                     bpage._keys[i] = ois.readObject();
                 }
@@ -1077,7 +1067,7 @@ public final class BPage implements Seri
                     serialized = readByteArray( ois );
                     if ( serialized != null )
                     {
-                        bpage._keys[i] = _btree._keySerializer.deserialize( serialized );
+                        bpage._keys[i] = btree.keySerializer.deserialize( serialized );
                     }
                 }
             }
@@ -1087,14 +1077,14 @@ public final class BPage implements Seri
             throw new IOException( except.getLocalizedMessage() );
         }
 
-        if ( bpage._isLeaf )
+        if ( bpage.isLeaf )
         {
-            bpage._values = new Object[_btree._pageSize];
+            bpage._values = new Object[btree.pageSize];
             try
             {
-                for ( int i = bpage._first; i < _btree._pageSize; i++ )
+                for ( int i = bpage._first; i < btree.pageSize; i++ )
                 {
-                    if ( _btree._valueSerializer == null )
+                    if ( btree.valueSerializer == null )
                     {
                         bpage._values[i] = ois.readObject();
                     }
@@ -1103,7 +1093,7 @@ public final class BPage implements Seri
                         serialized = readByteArray( ois );
                         if ( serialized != null )
                         {
-                            bpage._values[i] = _btree._valueSerializer.deserialize( serialized );
+                            bpage._values[i] = btree.valueSerializer.deserialize( serialized );
                         }
                     }
                 }
@@ -1115,10 +1105,10 @@ public final class BPage implements Seri
         }
         else
         {
-            bpage._children = new long[_btree._pageSize];
-            for ( int i = bpage._first; i < _btree._pageSize; i++ )
+            bpage.children = new long[btree.pageSize];
+            for ( int i = bpage._first; i < btree.pageSize; i++ )
             {
-                bpage._children[i] = ois.readLong();
+                bpage.children[i] = ois.readLong();
             }
         }
         ois.close();
@@ -1150,8 +1140,8 @@ public final class BPage implements Seri
         baos = new ByteArrayOutputStream();
         oos = new ObjectOutputStream( baos );
 
-        oos.writeBoolean( bpage._isLeaf );
-        if ( bpage._isLeaf )
+        oos.writeBoolean( bpage.isLeaf );
+        if ( bpage.isLeaf )
         {
             oos.writeLong( bpage._previous );
             oos.writeLong( bpage._next );
@@ -1159,9 +1149,9 @@ public final class BPage implements Seri
 
         oos.writeInt( bpage._first );
 
-        for ( int i = bpage._first; i < _btree._pageSize; i++ )
+        for ( int i = bpage._first; i < btree.pageSize; i++ )
         {
-            if ( _btree._keySerializer == null )
+            if ( btree.keySerializer == null )
             {
                 oos.writeObject( bpage._keys[i] );
             }
@@ -1169,7 +1159,7 @@ public final class BPage implements Seri
             {
                 if ( bpage._keys[i] != null )
                 {
-                    serialized = _btree._keySerializer.serialize( bpage._keys[i] );
+                    serialized = btree.keySerializer.serialize( bpage._keys[i] );
                     writeByteArray( oos, serialized );
                 }
                 else
@@ -1179,11 +1169,11 @@ public final class BPage implements Seri
             }
         }
 
-        if ( bpage._isLeaf )
+        if ( bpage.isLeaf )
         {
-            for ( int i = bpage._first; i < _btree._pageSize; i++ )
+            for ( int i = bpage._first; i < btree.pageSize; i++ )
             {
-                if ( _btree._valueSerializer == null )
+                if ( btree.valueSerializer == null )
                 {
                     oos.writeObject( bpage._values[i] );
                 }
@@ -1191,7 +1181,7 @@ public final class BPage implements Seri
                 {
                     if ( bpage._values[i] != null )
                     {
-                        serialized = _btree._valueSerializer.serialize( bpage._values[i] );
+                        serialized = btree.valueSerializer.serialize( bpage._values[i] );
                         writeByteArray( oos, serialized );
                     }
                     else
@@ -1203,9 +1193,9 @@ public final class BPage implements Seri
         }
         else
         {
-            for ( int i = bpage._first; i < _btree._pageSize; i++ )
+            for ( int i = bpage._first; i < btree.pageSize; i++ )
             {
-                oos.writeLong( bpage._children[i] );
+                oos.writeLong( bpage.children[i] );
             }
         }
 
@@ -1284,7 +1274,7 @@ public final class BPage implements Seri
 
         public boolean getNext( Tuple tuple ) throws IOException
         {
-            if ( _index < _page._btree._pageSize )
+            if ( _index < _page.btree.pageSize )
             {
                 if ( _page._keys[_index] == null )
                 {
@@ -1313,7 +1303,7 @@ public final class BPage implements Seri
                 if ( _page._previous != 0 )
                 {
                     _page = _page.loadBPage( _page._previous );
-                    _index = _page._btree._pageSize;
+                    _index = _page.btree.pageSize;
                 }
                 else
                 {

Modified: directory/apacheds/trunk/jdbm/src/main/java/jdbm/btree/BTree.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm/src/main/java/jdbm/btree/BTree.java?rev=943719&r1=943718&r2=943719&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm/src/main/java/jdbm/btree/BTree.java (original)
+++ directory/apacheds/trunk/jdbm/src/main/java/jdbm/btree/BTree.java Wed May 12 22:17:35 2010
@@ -94,66 +94,44 @@ public class BTree implements Externaliz
 
     private static final boolean DEBUG = false;
 
-    /**
-     * Version id for serialization.
-     */
+    /** Version id for serialization. */
     final static long serialVersionUID = 1L;
 
-    /**
-     * Default page size (number of entries per node)
-     */
+    /** Default page size (number of entries per node) */
     public static final int DEFAULT_SIZE = 16;
 
-    /**
-     * Page manager used to persist changes in BPages
-     */
-    protected transient RecordManager _recman;
+    /** Page manager used to persist changes in BPages */
+    protected transient RecordManager recordManager;
 
-    /**
-     * This BTree's record ID in the PageManager.
-     */
-    private transient long _recid;
+    /** This BTree's record ID in the PageManager. */
+    private transient long recordId;
 
-    /**
-     * Comparator used to index entries.
-     */
-    protected Comparator _comparator;
+    /** Comparator used to index entries. */
+    protected Comparator comparator;
 
-    /**
-     * Serializer used to serialize index keys (optional)
-     */
-    protected Serializer _keySerializer;
+    /** Serializer used to serialize index keys (optional) */
+    protected Serializer keySerializer;
 
-    /**
-     * Serializer used to serialize index values (optional)
-     */
-    protected Serializer _valueSerializer;
+    /** Serializer used to serialize index values (optional) */
+    protected Serializer valueSerializer;
 
     /**
      * Height of the B+Tree.  This is the number of BPages you have to traverse
      * to get to a leaf BPage, starting from the root.
      */
-    private int _height;
+    private int bTreeHeight;
 
-    /**
-     * Recid of the root BPage
-     */
-    private transient long _root;
+    /** Recid of the root BPage */
+    private transient long rootId;
 
-    /**
-     * Number of entries in each BPage.
-     */
-    protected int _pageSize;
+    /** Number of entries in each BPage. */
+    protected int pageSize;
 
-    /**
-     * Total number of entries in the BTree
-     */
-    protected int _entries;
+    /** Total number of entries in the BTree */
+    protected int nbEntries;
 
-    /**
-     * Serializer used for BPages of this tree
-     */
-    private transient BPage _bpageSerializer;
+    /** Serializer used for BPages of this tree */
+    private transient BPage bpageSerializer;
 
 
     /**
@@ -238,14 +216,14 @@ public class BTree implements Externaliz
         }
 
         btree = new BTree();
-        btree._recman = recman;
-        btree._comparator = comparator;
-        btree._keySerializer = keySerializer;
-        btree._valueSerializer = valueSerializer;
-        btree._pageSize = pageSize;
-        btree._bpageSerializer = new BPage();
-        btree._bpageSerializer._btree = btree;
-        btree._recid = recman.insert( btree );
+        btree.recordManager = recman;
+        btree.comparator = comparator;
+        btree.keySerializer = keySerializer;
+        btree.valueSerializer = valueSerializer;
+        btree.pageSize = pageSize;
+        btree.bpageSerializer = new BPage();
+        btree.bpageSerializer.btree = btree;
+        btree.recordId = recman.insert( btree );
         return btree;
     }
 
@@ -259,10 +237,10 @@ public class BTree implements Externaliz
     public static BTree load( RecordManager recman, long recid ) throws IOException
     {
         BTree btree = ( BTree ) recman.fetch( recid );
-        btree._recid = recid;
-        btree._recman = recman;
-        btree._bpageSerializer = new BPage();
-        btree._bpageSerializer._btree = btree;
+        btree.recordId = recid;
+        btree.recordManager = recman;
+        btree.bpageSerializer = new BPage();
+        btree.bpageSerializer.btree = btree;
         return btree;
     }
 
@@ -300,15 +278,15 @@ public class BTree implements Externaliz
                 System.out.println( "BTree.insert() new root BPage" );
             }
             rootPage = new BPage( this, key, value );
-            _root = rootPage._recid;
-            _height = 1;
-            _entries = 1;
-            _recman.update( _recid, this );
+            rootId = rootPage._recid;
+            bTreeHeight = 1;
+            nbEntries = 1;
+            recordManager.update( recordId, this );
             return null;
         }
         else
         {
-            BPage.InsertResult insert = rootPage.insert( _height, key, value, replace );
+            BPage.InsertResult insert = rootPage.insert( bTreeHeight, key, value, replace );
             boolean dirty = false;
             if ( insert._overflow != null )
             {
@@ -318,18 +296,18 @@ public class BTree implements Externaliz
                     System.out.println( "BTree.insert() replace root BPage due to overflow" );
                 }
                 rootPage = new BPage( this, rootPage, insert._overflow );
-                _root = rootPage._recid;
-                _height += 1;
+                rootId = rootPage._recid;
+                bTreeHeight += 1;
                 dirty = true;
             }
             if ( insert._existing == null )
             {
-                _entries++;
+                nbEntries++;
                 dirty = true;
             }
             if ( dirty )
             {
-                _recman.update( _recid, this );
+                recordManager.update( recordId, this );
             }
             // insert might have returned an existing value
             return insert._existing;
@@ -357,30 +335,30 @@ public class BTree implements Externaliz
             return null;
         }
         boolean dirty = false;
-        BPage.RemoveResult remove = rootPage.remove( _height, key );
+        BPage.RemoveResult remove = rootPage.remove( bTreeHeight, key );
         if ( remove._underflow && rootPage.isEmpty() )
         {
-            _height -= 1;
+            bTreeHeight -= 1;
             dirty = true;
 
-            _recman.delete( _root );
-            if ( _height == 0 )
+            recordManager.delete( rootId );
+            if ( bTreeHeight == 0 )
             {
-                _root = 0;
+                rootId = 0;
             }
             else
             {
-                _root = rootPage.childBPage( _pageSize - 1 )._recid;
+                rootId = rootPage.childBPage( pageSize - 1 )._recid;
             }
         }
         if ( remove._value != null )
         {
-            _entries--;
+            nbEntries--;
             dirty = true;
         }
         if ( dirty )
         {
-            _recman.update( _recid, this );
+            recordManager.update( recordId, this );
         }
         return remove._value;
     }
@@ -405,13 +383,13 @@ public class BTree implements Externaliz
         }
 
         Tuple tuple = new Tuple( null, null );
-        TupleBrowser browser = rootPage.find( _height, key );
+        TupleBrowser browser = rootPage.find( bTreeHeight, key );
 
         if ( browser.getNext( tuple ) )
         {
             // find returns the matching key or the next ordered key, so we must
             // check if we have an exact match
-            if ( _comparator.compare( key, tuple.getKey() ) != 0 )
+            if ( comparator.compare( key, tuple.getKey() ) != 0 )
             {
                 return null;
             }
@@ -500,7 +478,7 @@ public class BTree implements Externaliz
         {
             return EmptyBrowser.INSTANCE;
         }
-        TupleBrowser browser = rootPage.find( _height, key );
+        TupleBrowser browser = rootPage.find( bTreeHeight, key );
         return browser;
     }
 
@@ -510,7 +488,7 @@ public class BTree implements Externaliz
      */
     public synchronized int size()
     {
-        return _entries;
+        return nbEntries;
     }
 
 
@@ -519,7 +497,7 @@ public class BTree implements Externaliz
      */
     public long getRecid()
     {
-        return _recid;
+        return recordId;
     }
 
 
@@ -528,13 +506,13 @@ public class BTree implements Externaliz
      */
     private BPage getRoot() throws IOException
     {
-        if ( _root == 0 )
+        if ( rootId == 0 )
         {
             return null;
         }
-        BPage root = ( BPage ) _recman.fetch( _root, _bpageSerializer );
-        root._recid = _root;
-        root._btree = this;
+        BPage root = ( BPage ) recordManager.fetch( rootId, bpageSerializer );
+        root._recid = rootId;
+        root.btree = this;
         return root;
     }
 
@@ -544,13 +522,13 @@ public class BTree implements Externaliz
      */
     public void readExternal( ObjectInput in ) throws IOException, ClassNotFoundException
     {
-        _comparator = ( Comparator ) in.readObject();
-        _keySerializer = ( Serializer ) in.readObject();
-        _valueSerializer = ( Serializer ) in.readObject();
-        _height = in.readInt();
-        _root = in.readLong();
-        _pageSize = in.readInt();
-        _entries = in.readInt();
+        comparator = ( Comparator ) in.readObject();
+        keySerializer = ( Serializer ) in.readObject();
+        valueSerializer = ( Serializer ) in.readObject();
+        bTreeHeight = in.readInt();
+        rootId = in.readLong();
+        pageSize = in.readInt();
+        nbEntries = in.readInt();
     }
 
 
@@ -559,39 +537,22 @@ public class BTree implements Externaliz
      */
     public void writeExternal( ObjectOutput out ) throws IOException
     {
-        out.writeObject( _comparator );
-        out.writeObject( _keySerializer );
-        out.writeObject( _valueSerializer );
-        out.writeInt( _height );
-        out.writeLong( _root );
-        out.writeInt( _pageSize );
-        out.writeInt( _entries );
+        out.writeObject( comparator );
+        out.writeObject( keySerializer );
+        out.writeObject( valueSerializer );
+        out.writeInt( bTreeHeight );
+        out.writeLong( rootId );
+        out.writeInt( pageSize );
+        out.writeInt( nbEntries );
     }
 
 
     public void setValueSerializer( Serializer valueSerializer )
     {
-        _valueSerializer = valueSerializer;
-    }
-
-    /*
-    public void assert() throws IOException {
-        BPage root = getRoot();
-        if ( root != null ) {
-            root.assertRecursive( _height );
-        }
-    }
-    */
-
-    /*
-    public void dump() throws IOException {
-        BPage root = getRoot();
-        if ( root != null ) {
-            root.dumpRecursive( _height, 0 );
-        }
+        this.valueSerializer = valueSerializer;
     }
-    */
 
+    
     /** PRIVATE INNER CLASS
      *  Browser returning no element.
      */
@@ -615,10 +576,10 @@ public class BTree implements Externaliz
 
 
     /**
-     * @return the _comparator
+     * @return the comparator
      */
     public Comparator getComparator()
     {
-        return _comparator;
+        return comparator;
     }
 }

Modified: directory/apacheds/trunk/jdbm/src/main/java/jdbm/helper/MRU.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm/src/main/java/jdbm/helper/MRU.java?rev=943719&r1=943718&r2=943719&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm/src/main/java/jdbm/helper/MRU.java (original)
+++ directory/apacheds/trunk/jdbm/src/main/java/jdbm/helper/MRU.java Wed May 12 22:17:35 2010
@@ -177,7 +177,7 @@ public class MRU implements CachePolicy 
      */
     public void addListener(CachePolicyListener listener) {
         if (listener == null) {
-            throw new IllegalArgumentException( I18n.err( I18n.ERR_539 ) );
+            throw new IllegalArgumentException( I18n.err( I18n.ERR_539_BAD_BLOCK_ID ) );
         }
         if ( ! listeners.contains(listener)) {
             listeners.addElement(listener);

Modified: directory/apacheds/trunk/jdbm/src/main/java/jdbm/helper/Serialization.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm/src/main/java/jdbm/helper/Serialization.java?rev=943719&r1=943718&r2=943719&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm/src/main/java/jdbm/helper/Serialization.java (original)
+++ directory/apacheds/trunk/jdbm/src/main/java/jdbm/helper/Serialization.java Wed May 12 22:17:35 2010
@@ -67,6 +67,7 @@ public final class Serialization
     public static byte[] serialize( Object obj )
         throws IOException
     {
+        long tt0 = System.currentTimeMillis();
         ByteArrayOutputStream  baos;
         ObjectOutputStream     oos;
 
@@ -75,7 +76,16 @@ public final class Serialization
         oos.writeObject( obj );
         oos.close();
 
-        return baos.toByteArray();
+        long tt1 = System.currentTimeMillis();
+        byte[] res = baos.toByteArray();
+        long tt2 = System.currentTimeMillis();
+        
+        if ( tt2 - tt0 > 400 )
+        {
+            System.out.println( ( tt1 - tt0 ) + " /  " + ( tt2 - tt1 ) );
+        }
+        
+        return res;
     }
 
 

Modified: directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/BaseRecordManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/BaseRecordManager.java?rev=943719&r1=943718&r2=943719&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/BaseRecordManager.java (original)
+++ directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/BaseRecordManager.java Wed May 12 22:17:35 2010
@@ -86,7 +86,7 @@ public final class BaseRecordManager
     implements RecordManager
 {
 
-    /** Underlying record file. */
+    /** Underlying record recordFile. */
     private RecordFile recordFile;
 
     /** Physical row identifier manager. */
@@ -122,8 +122,8 @@ public final class BaseRecordManager
     {
         recordFile = new RecordFile( filename );
         pageMgr = new PageManager( recordFile );
-        physMgr = new PhysicalRowIdManager( recordFile, pageMgr );
-        logMgr = new LogicalRowIdManager( recordFile, pageMgr );
+        physMgr = new PhysicalRowIdManager( pageMgr );
+        logMgr = new LogicalRowIdManager( pageMgr );
     }
 
 
@@ -271,8 +271,23 @@ public final class BaseRecordManager
 
         Location logRecid = new Location( recid );
         Location physRecid = logMgr.fetch( logRecid );
+        long t3 = 0;
+
+        String c = obj.getClass().getName();
         
+        long t0 = System.currentTimeMillis();
         byte[] data = serializer.serialize( obj );
+        long t1 = System.currentTimeMillis();
+        
+        if ( ( ( ( t1 - t0 ) ) > 400 ) && c.equals( "java.lang.Integer" ) )
+        {
+            System.out.println( (t1-t0) + " : " + c );
+            
+            long tt0 = System.currentTimeMillis();
+            byte[] data2 = serializer.serialize( obj );
+            long tt1 = System.currentTimeMillis();
+            System.out.println( (tt1-tt0) + " *: " + c );
+        }
         
         if ( DEBUG ) 
         {
@@ -280,11 +295,19 @@ public final class BaseRecordManager
         }
         
         Location newRecid = physMgr.update( physRecid, data, 0, data.length );
+        long t2 = System.nanoTime();
         
         if ( ! newRecid.equals( physRecid ) ) 
         {
             logMgr.update( logRecid, newRecid );
+            t3 = System.nanoTime();
         }
+        else
+        {
+            t3 = t2;
+        }
+
+        //System.out.println( "serailize : " + (t1 - t0)/1000 + ", pysical = " + ( t2 - t1 ) / 1000 + ", logical = " + ( t3 - t2 ) / 1000 );
     }
 
 

Modified: directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/BlockIo.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/BlockIo.java?rev=943719&r1=943718&r2=943719&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/BlockIo.java (original)
+++ directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/BlockIo.java Wed May 12 22:17:35 2010
@@ -47,7 +47,9 @@
 package jdbm.recman;
 
 
-import java.io.*;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 
 import org.apache.directory.server.i18n.I18n;
 
@@ -57,6 +59,8 @@ import org.apache.directory.server.i18n.
  * write data to and from it. The readers and writers are just the ones that 
  * the rest of the toolkit needs, nothing else. Values written are compatible 
  * with java.io routines.
+ * 
+ * This block is never accessed directly, so it does not have to be thread-safe.
  *
  * @see java.io.DataInput
  * @see java.io.DataOutput
@@ -65,11 +69,18 @@ public final class BlockIo implements ja
 {
     public final static long serialVersionUID = 2L;
 
+    /** The block Identifier */
     private long blockId;
 
-    private transient byte[] data; // work area
+    /** The row data contained in this block */
+    private transient byte[] data;
+    
     private transient BlockView view = null;
+    
+    /** A flag set when this block has been modified */
     private transient boolean dirty = false;
+    
+    /** The number of pending transaction on this block */
     private transient int transactionCount = 0;
 
     
@@ -83,14 +94,17 @@ public final class BlockIo implements ja
 
     
     /**
-     * Constructs a new BlockIo instance working on the indicated buffer.
+     * Constructs a new BlockIo instance.
+     * 
+     * @param blockId The identifier for this block
+     * @param data The data to store
      */
     BlockIo( long blockId, byte[] data ) 
     {
         // remove me for production version
-        if ( blockId > 10000000000L )
+        if ( blockId < 0 )
         {
-            throw new Error( I18n.err( I18n.ERR_539, blockId ) );
+            throw new Error( I18n.err( I18n.ERR_539_BAD_BLOCK_ID, blockId ) );
         }
         
         this.blockId = blockId;
@@ -99,7 +113,7 @@ public final class BlockIo implements ja
 
     
     /**
-     * Returns the underlying array
+     * @return the underlying array
      */
     byte[] getData() 
     {
@@ -109,26 +123,27 @@ public final class BlockIo implements ja
     
     /**
      * Sets the block number. Should only be called by RecordFile.
+     * 
+     * @param The block identifier
      */
-    void setBlockId( long id ) 
+    void setBlockId( long blockId ) 
     {
         if ( isInTransaction() )
         {
             throw new Error( I18n.err( I18n.ERR_540 ) );
         }
         
-        // remove me for production version
-        if (id > 10000000000L)
+        if ( blockId < 0 )
         {
-            throw new Error( I18n.err( I18n.ERR_539, id ) );
+            throw new Error( I18n.err( I18n.ERR_539_BAD_BLOCK_ID, blockId ) );
         }
             
-        blockId = id;
+        this.blockId = blockId;
     }
 
     
     /**
-     * Returns the block number.
+     * @return the block number.
      */
     long getBlockId() 
     {
@@ -137,7 +152,7 @@ public final class BlockIo implements ja
 
     
     /**
-     * Returns the current view of the block.
+     * @return the current view of the block.
      */
     public BlockView getView() 
     {
@@ -193,7 +208,7 @@ public final class BlockIo implements ja
 
     /**
      * Increments transaction count for this block, to signal that this
-     * block is in the log but not yet in the data file. The method also
+     * block is in the log but not yet in the data recordFile. The method also
      * takes a snapshot so that the data may be modified in new transactions.
      */
     synchronized void incrementTransactionCount() 
@@ -207,11 +222,12 @@ public final class BlockIo implements ja
     
     /**
      * Decrements transaction count for this block, to signal that this
-     * block has been written from the log to the data file.
+     * block has been written from the log to the data recordFile.
      */
     synchronized void decrementTransactionCount() 
     {
         transactionCount--;
+        
         if ( transactionCount < 0 )
         {
             throw new Error( I18n.err( I18n.ERR_541, getBlockId() ) );
@@ -302,17 +318,6 @@ public final class BlockIo implements ja
                         ( ( data[pos+5] & 0xff ) << 16 ) |
                         ( ( data[pos+6] & 0xff ) <<  8 ) |
                         ( ( data[pos+7] & 0xff )       ) ) & 0xffffffff );
-        /* Original version by Alex Boisvert.  Might be faster on 64-bit JVMs.
-        return
-            ( ( ( long ) ( data[pos+0] & 0xff ) << 56 ) |
-              ( ( long ) ( data[pos+1] & 0xff ) << 48 ) |
-              ( ( long ) ( data[pos+2] & 0xff ) << 40 ) |
-              ( ( long ) ( data[pos+3] & 0xff ) << 32 ) |
-              ( ( long ) ( data[pos+4] & 0xff ) << 24 ) |
-              ( ( long ) ( data[pos+5] & 0xff ) << 16 ) |
-              ( ( long ) ( data[pos+6] & 0xff ) <<  8 ) |
-              ( ( long ) ( data[pos+7] & 0xff ) <<  0 ) );
-        */
     }
 
     
@@ -355,7 +360,6 @@ public final class BlockIo implements ja
 
     
     // implement externalizable interface
-
     public void writeExternal( ObjectOutput out ) throws IOException 
     {
         out.writeLong( blockId );

Modified: directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/CacheRecordManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/CacheRecordManager.java?rev=943719&r1=943718&r2=943719&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/CacheRecordManager.java (original)
+++ directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/CacheRecordManager.java Wed May 12 22:17:35 2010
@@ -343,8 +343,11 @@ public class CacheRecordManager implemen
     public synchronized void commit() throws IOException
     {
         checkIfClosed();
+        long t0 = System.nanoTime();
         updateCacheEntries();
+        long t1 = System.nanoTime();
         recMgr.commit();
+        long t2 = System.nanoTime();
     }
 
 
@@ -404,9 +407,11 @@ public class CacheRecordManager implemen
     protected void updateCacheEntries() throws IOException
     {
         Enumeration<CacheEntry> enume = cache.elements();
+        
         while ( enume.hasMoreElements() ) 
         {
             CacheEntry entry = enume.nextElement();
+            
             if ( entry.isDirty ) 
             {
                 recMgr.update( entry.recid, entry.obj, entry.serializer );
@@ -416,6 +421,9 @@ public class CacheRecordManager implemen
     }
 
     
+    /**
+     * A class to store a cached entry. 
+     */
     private class CacheEntry
     {
         long recid;

Modified: directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/FreeLogicalRowIdPageManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/FreeLogicalRowIdPageManager.java?rev=943719&r1=943718&r2=943719&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/FreeLogicalRowIdPageManager.java (original)
+++ directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/FreeLogicalRowIdPageManager.java Wed May 12 22:17:35 2010
@@ -54,19 +54,18 @@ import java.io.IOException;
  *  to free and allocate Logical rowids on a high level.
  */
 final class FreeLogicalRowIdPageManager {
-    // our record file
-    private RecordFile file;
+    // our record recordFile
+    private RecordFile recordFile;
     // our page manager
-    private PageManager pageman;
+    private PageManager pageManager;
 
     /**
      *  Creates a new instance using the indicated record file and
      *  page manager.
      */
-    FreeLogicalRowIdPageManager(RecordFile file,
-                                PageManager pageman) throws IOException {
-        this.file = file;
-        this.pageman = pageman;
+    FreeLogicalRowIdPageManager( PageManager pageManager) throws IOException {
+        this.pageManager = pageManager;
+        this.recordFile = pageManager.getRecordFile();
     }
 
     /**
@@ -78,10 +77,10 @@ final class FreeLogicalRowIdPageManager 
         // Loop through the free Logical rowid list until we find
         // the first rowid.
         Location retval = null;
-        PageCursor curs = new PageCursor(pageman, Magic.FREELOGIDS_PAGE);
+        PageCursor curs = new PageCursor(pageManager, Magic.FREELOGIDS_PAGE);
         while (curs.next() != 0) {
             FreeLogicalRowIdPage fp = FreeLogicalRowIdPage
-                .getFreeLogicalRowIdPageView(file.get(curs.getCurrent()));
+                .getFreeLogicalRowIdPageView(recordFile.get(curs.getCurrent()));
             int slot = fp.getFirstAllocated();
             if (slot != -1) {
                 // got one!
@@ -90,17 +89,17 @@ final class FreeLogicalRowIdPageManager 
                 fp.free(slot);
                 if (fp.getCount() == 0) {
                     // page became empty - free it
-                    file.release(curs.getCurrent(), false);
-                    pageman.free(Magic.FREELOGIDS_PAGE, curs.getCurrent());
+                    recordFile.release(curs.getCurrent(), false);
+                    pageManager.free(Magic.FREELOGIDS_PAGE, curs.getCurrent());
                 }
                 else
-                    file.release(curs.getCurrent(), true);
+                    recordFile.release(curs.getCurrent(), true);
                 
                 return retval;
             }
             else {
                 // no luck, go to next page
-                file.release(curs.getCurrent(), false);
+                recordFile.release(curs.getCurrent(), false);
             }     
         }
         return null;
@@ -113,11 +112,11 @@ final class FreeLogicalRowIdPageManager 
     throws IOException {
         
         PhysicalRowId free = null;
-        PageCursor curs = new PageCursor(pageman, Magic.FREELOGIDS_PAGE);
+        PageCursor curs = new PageCursor(pageManager, Magic.FREELOGIDS_PAGE);
         long freePage = 0;
         while (curs.next() != 0) {
             freePage = curs.getCurrent();
-            BlockIo curBlock = file.get(freePage);
+            BlockIo curBlock = recordFile.get(freePage);
             FreeLogicalRowIdPage fp = FreeLogicalRowIdPage
                 .getFreeLogicalRowIdPageView(curBlock);
             int slot = fp.getFirstFree();
@@ -126,18 +125,18 @@ final class FreeLogicalRowIdPageManager 
                 break;
             }
             
-            file.release(curBlock);
+            recordFile.release(curBlock);
         }
         if (free == null) {
             // No more space on the free list, add a page.
-            freePage = pageman.allocate(Magic.FREELOGIDS_PAGE);
-            BlockIo curBlock = file.get(freePage);
+            freePage = pageManager.allocate(Magic.FREELOGIDS_PAGE);
+            BlockIo curBlock = recordFile.get(freePage);
             FreeLogicalRowIdPage fp = 
                 FreeLogicalRowIdPage.getFreeLogicalRowIdPageView(curBlock);
             free = fp.alloc(0);
         }
         free.setBlock(rowid.getBlock());
         free.setOffset(rowid.getOffset());
-        file.release(freePage, true);
+        recordFile.release(freePage, true);
     }
 }

Modified: directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/FreePhysicalRowIdPageManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/FreePhysicalRowIdPageManager.java?rev=943719&r1=943718&r2=943719&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/FreePhysicalRowIdPageManager.java (original)
+++ directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/FreePhysicalRowIdPageManager.java Wed May 12 22:17:35 2010
@@ -56,20 +56,20 @@ import java.io.IOException;
  */
 final class FreePhysicalRowIdPageManager
 {
-    // our record file
-    protected RecordFile file;
+    // our record recordFile
+    protected RecordFile recordFile;
 
     // our page manager
-    protected PageManager pageman;
+    protected PageManager pageManager;
 
     
     /**
-     * Creates a new instance using the indicated record file and page manager.
+     * Creates a new instance using the indicated record recordFile and page manager.
      */
-    FreePhysicalRowIdPageManager( RecordFile file, PageManager pageman ) throws IOException
+    FreePhysicalRowIdPageManager( PageManager pageManager ) throws IOException
     {
-        this.file = file;
-        this.pageman = pageman;
+        this.recordFile = pageManager.getRecordFile();
+        this.pageManager = pageManager;
     }
 
 
@@ -82,12 +82,12 @@ final class FreePhysicalRowIdPageManager
         // Loop through the free physical rowid list until we find a rowid 
         // that's large enough.
         Location retval = null;
-        PageCursor curs = new PageCursor( pageman, Magic.FREEPHYSIDS_PAGE );
+        PageCursor curs = new PageCursor( pageManager, Magic.FREEPHYSIDS_PAGE );
 
         while ( curs.next() != 0 ) 
         {
             FreePhysicalRowIdPage fp = FreePhysicalRowIdPage
-                .getFreePhysicalRowIdPageView( file.get( curs.getCurrent() ) );
+                .getFreePhysicalRowIdPageView( recordFile.get( curs.getCurrent() ) );
             int slot = fp.getFirstLargerThan( size );
             
             if ( slot != -1 ) 
@@ -99,12 +99,12 @@ final class FreePhysicalRowIdPageManager
                 if ( fp.getCount() == 0 ) 
                 {
                     // page became empty - free it
-                    file.release( curs.getCurrent(), false );
-                    pageman.free( Magic.FREEPHYSIDS_PAGE, curs.getCurrent() );
+                    recordFile.release( curs.getCurrent(), false );
+                    pageManager.free( Magic.FREEPHYSIDS_PAGE, curs.getCurrent() );
                 } 
                 else 
                 {
-                    file.release( curs.getCurrent(), true );
+                    recordFile.release( curs.getCurrent(), true );
                 }
 
                 return retval;
@@ -112,7 +112,7 @@ final class FreePhysicalRowIdPageManager
             else 
             {
                 // no luck, go to next page
-                file.release( curs.getCurrent(), false );
+                recordFile.release( curs.getCurrent(), false );
             }
         }
         return null;
@@ -125,13 +125,13 @@ final class FreePhysicalRowIdPageManager
     void put( Location rowid, int size ) throws IOException 
     {
         FreePhysicalRowId free = null;
-        PageCursor curs = new PageCursor( pageman, Magic.FREEPHYSIDS_PAGE );
+        PageCursor curs = new PageCursor( pageManager, Magic.FREEPHYSIDS_PAGE );
         long freePage = 0;
         
         while ( curs.next() != 0 ) 
         {
             freePage = curs.getCurrent();
-            BlockIo curBlock = file.get( freePage );
+            BlockIo curBlock = recordFile.get( freePage );
             FreePhysicalRowIdPage fp = FreePhysicalRowIdPage.getFreePhysicalRowIdPageView( curBlock );
             int slot = fp.getFirstFree();
       
@@ -141,14 +141,14 @@ final class FreePhysicalRowIdPageManager
                 break;
             }
 
-            file.release( curBlock );
+            recordFile.release( curBlock );
         }
   
         if ( free == null ) 
         {
             // No more space on the free list, add a page.
-            freePage = pageman.allocate( Magic.FREEPHYSIDS_PAGE );
-            BlockIo curBlock = file.get( freePage );
+            freePage = pageManager.allocate( Magic.FREEPHYSIDS_PAGE );
+            BlockIo curBlock = recordFile.get( freePage );
             FreePhysicalRowIdPage fp = FreePhysicalRowIdPage.getFreePhysicalRowIdPageView( curBlock );
             free = fp.alloc( 0 );
         }
@@ -156,6 +156,6 @@ final class FreePhysicalRowIdPageManager
         free.setBlock( rowid.getBlock() );
         free.setOffset( rowid.getOffset() );
         free.setSize( size );
-        file.release( freePage, true );
+        recordFile.release( freePage, true );
     }
 }

Modified: directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/LogicalRowIdManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/LogicalRowIdManager.java?rev=943719&r1=943718&r2=943719&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/LogicalRowIdManager.java (original)
+++ directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/LogicalRowIdManager.java Wed May 12 22:17:35 2010
@@ -47,100 +47,111 @@
 
 package jdbm.recman;
 
+
 import java.io.IOException;
 
 import org.apache.directory.server.i18n.I18n;
 
+
 /**
  *  This class manages the linked lists of logical rowid pages.
  */
-final class LogicalRowIdManager {
-    // our record file and associated page manager
-    private RecordFile file;
-    private PageManager pageman;
+final class LogicalRowIdManager
+{
+    // our record recordFile and associated page manager
+    private RecordFile recordFile;
+    private PageManager pageManager;
     private FreeLogicalRowIdPageManager freeman;
 
+
     /**
-     *  Creates a log rowid manager using the indicated record file and
+     *  Creates a log rowid manager using the indicated record recordFile and
      *  page manager
      */
-    LogicalRowIdManager(RecordFile file, PageManager pageman)
-  throws IOException {
-  this.file = file;
-  this.pageman = pageman;
-  this.freeman = new FreeLogicalRowIdPageManager(file, pageman);
-
+    LogicalRowIdManager( PageManager pageManager ) throws IOException
+    {
+        this.recordFile = pageManager.getRecordFile();
+        this.pageManager = pageManager;
+        this.freeman = new FreeLogicalRowIdPageManager( pageManager );
     }
 
+
     /**
      *  Creates a new logical rowid pointing to the indicated physical
      *  id
      */
-    Location insert(Location loc)
-    throws IOException {
-  // check whether there's a free rowid to reuse
-  Location retval = freeman.get();
-  if (retval == null) {
-      // no. This means that we bootstrap things by allocating
-      // a new translation page and freeing all the rowids on it.
-      long firstPage = pageman.allocate(Magic.TRANSLATION_PAGE);
-      short curOffset = TranslationPage.O_TRANS;
-      for (int i = 0; i < TranslationPage.ELEMS_PER_PAGE; i++) {
-    freeman.put(new Location(firstPage, curOffset));
-    curOffset += PhysicalRowId.SIZE;
-      }
-      retval = freeman.get();
-      if (retval == null) {
-    throw new Error( I18n.err( I18n.ERR_545 ) );
-      }
-  }
-  // write the translation.
-  update(retval, loc);
-  return retval;
+    Location insert( Location loc ) throws IOException
+    {
+        // check whether there's a free rowid to reuse
+        Location retval = freeman.get();
+        if ( retval == null )
+        {
+            // no. This means that we bootstrap things by allocating
+            // a new translation page and freeing all the rowids on it.
+            long firstPage = pageManager.allocate( Magic.TRANSLATION_PAGE );
+            short curOffset = TranslationPage.O_TRANS;
+            for ( int i = 0; i < TranslationPage.ELEMS_PER_PAGE; i++ )
+            {
+                freeman.put( new Location( firstPage, curOffset ) );
+                curOffset += PhysicalRowId.SIZE;
+            }
+            retval = freeman.get();
+            if ( retval == null )
+            {
+                throw new Error( I18n.err( I18n.ERR_545 ) );
+            }
+        }
+        // write the translation.
+        update( retval, loc );
+        return retval;
     }
 
+
     /**
      *  Releases the indicated logical rowid.
      */
-    void delete(Location rowid)
-  throws IOException {
+    void delete( Location rowid ) throws IOException
+    {
 
-  freeman.put(rowid);
+        freeman.put( rowid );
     }
 
+
     /**
      *  Updates the mapping
      *
      *  @param rowid The logical rowid
      *  @param loc The physical rowid
      */
-    void update(Location rowid, Location loc)
-    throws IOException {
+    void update( Location rowid, Location loc ) throws IOException
+    {
 
-        TranslationPage xlatPage = TranslationPage.getTranslationPageView(
-                                       file.get(rowid.getBlock()));
-        PhysicalRowId physid = xlatPage.get(rowid.getOffset());
-        physid.setBlock(loc.getBlock());
-        physid.setOffset(loc.getOffset());
-        file.release(rowid.getBlock(), true);
+        TranslationPage xlatPage = TranslationPage.getTranslationPageView( recordFile.get( rowid.getBlock() ) );
+        PhysicalRowId physid = xlatPage.get( rowid.getOffset() );
+        physid.setBlock( loc.getBlock() );
+        physid.setOffset( loc.getOffset() );
+        recordFile.release( rowid.getBlock(), true );
     }
 
+
     /**
      *  Returns a mapping
      *
      *  @param rowid The logical rowid
      *  @return The physical rowid
      */
-    Location fetch(Location rowid)
-    throws IOException {
+    Location fetch( Location rowid ) throws IOException
+    {
 
-        TranslationPage xlatPage = TranslationPage.getTranslationPageView(
-                                       file.get(rowid.getBlock()));
-        try {
-            Location retval = new Location(xlatPage.get(rowid.getOffset()));
+        TranslationPage xlatPage = TranslationPage.getTranslationPageView( recordFile.get( rowid.getBlock() ) );
+        try
+        {
+            Location retval = new Location( xlatPage.get( rowid.getOffset() ) );
             return retval;
-        } finally {
-            file.release(rowid.getBlock(), false);
+        }
+        finally
+        {
+            recordFile.release( rowid.getBlock(), false );
         }
     }
 

Modified: directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/PageManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/PageManager.java?rev=943719&r1=943718&r2=943719&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/PageManager.java (original)
+++ directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/PageManager.java Wed May 12 22:17:35 2010
@@ -53,34 +53,36 @@ import org.apache.directory.server.i18n.
 
 
 /**
- * This class manages the linked lists of pages that make up a file.
+ * This class manages the linked lists of pages that make up a recordFile.
  */
 final class PageManager 
 {
-    // our record file
-    private RecordFile file;
+    // our record recordFile
+    private RecordFile recordFile;
+    
     // header data
     private FileHeader header;
-    // file header containing block
+    
+    // recordFile header containing block
     private BlockIo headerBuf;
 
     
     /**
-     * Creates a new page manager using the indicated record file.
+     * Creates a new page manager using the indicated record recordFile.
      */
-    PageManager( RecordFile file ) throws IOException 
+    PageManager( RecordFile recordFile ) throws IOException 
     {
-        this.file = file;
+        this.recordFile = recordFile;
         
-        // Note that we hold on to the file header node.
-        headerBuf = file.get( 0 );
+        // Note that we hold on to the recordFile header node.
+        headerBuf = recordFile.get( 0 );
         
-        // Assume file is new if the file header's magic number is 0. 
+        // Assume recordFile is new if the recordFile header's magic number is 0. 
         if ( headerBuf.readShort( 0 ) == 0 )
         {
             header = new FileHeader( headerBuf, true );
         }
-        else // header is for existing file
+        else // header is for existing recordFile
         {
             header = new FileHeader( headerBuf, false );
         }
@@ -114,7 +116,7 @@ final class PageManager 
 
             if ( retval == 0 )
             {
-                // very new file - allocate record #1
+                // very new recordFile - allocate record #1
                 retval = 1;
             }
             
@@ -123,7 +125,7 @@ final class PageManager 
         }
         
         // Cool. We have a record, add it to the correct list
-        BlockIo buf = file.get( retval );
+        BlockIo buf = recordFile.get( retval );
         PageHeader pageHdr = null;
         
         if ( isNew )
@@ -150,15 +152,15 @@ final class PageManager 
         }
         
         header.setLastOf( type, retval );
-        file.release( retval, true );
+        recordFile.release( retval, true );
         
         // If there's a previous, fix up its pointer
         if ( oldLast != 0 ) 
         {
-            buf = file.get( oldLast );
+            buf = recordFile.get( oldLast );
             pageHdr = PageHeader.getView( buf );
             pageHdr.setNext( retval );
-            file.release( oldLast, true );
+            recordFile.release( oldLast, true );
         }
         
         // remove the view, we have modified the type.
@@ -184,7 +186,7 @@ final class PageManager 
         }
         
         // get the page and read next and previous pointers
-        BlockIo buf = file.get( recid );
+        BlockIo buf = recordFile.get( recid );
         PageHeader pageHdr = PageHeader.getView( buf );
         long prev = pageHdr.getPrev();
         long next = pageHdr.getNext();
@@ -195,15 +197,15 @@ final class PageManager 
         pageHdr.setPrev( 0 );
         
         header.setFirstOf( Magic.FREE_PAGE, recid );
-        file.release( recid, true );
+        recordFile.release( recid, true );
         
         // remove the page from its old list
         if ( prev != 0 ) 
         {
-            buf = file.get( prev );
+            buf = recordFile.get( prev );
             pageHdr = PageHeader.getView( buf );
             pageHdr.setNext( next );
-            file.release( prev, true );
+            recordFile.release( prev, true );
         }
         else 
         {
@@ -212,10 +214,10 @@ final class PageManager 
         
         if ( next != 0 ) 
         {
-            buf = file.get( next );
+            buf = recordFile.get( next );
             pageHdr = PageHeader.getView( buf );
             pageHdr.setPrev( prev );
-            file.release( next, true );
+            recordFile.release( next, true );
         }
         else 
         {
@@ -231,11 +233,11 @@ final class PageManager 
     {
         try 
         {
-            return PageHeader.getView( file.get( block ) ).getNext();
+            return PageHeader.getView( recordFile.get( block ) ).getNext();
         } 
         finally 
         {
-            file.release( block, false );
+            recordFile.release( block, false );
         }
     }
     
@@ -247,11 +249,11 @@ final class PageManager 
     {
         try 
         {
-            return PageHeader.getView( file.get( block ) ).getPrev();
+            return PageHeader.getView( recordFile.get( block ) ).getPrev();
         } 
         finally 
         {
-            file.release( block, false );
+            recordFile.release( block, false );
         }
     }
     
@@ -282,11 +284,11 @@ final class PageManager 
     void commit() throws IOException 
     {
         // write the header out
-        file.release( headerBuf );
-        file.commit();
+        recordFile.release( headerBuf );
+        recordFile.commit();
 
         // and obtain it again
-        headerBuf = file.get( 0 );
+        headerBuf = recordFile.get( 0 );
         header = new FileHeader( headerBuf, false );
     }
 
@@ -300,10 +302,10 @@ final class PageManager 
     void rollback() throws IOException 
     {
         // release header
-        file.discard( headerBuf );
-        file.rollback();
+        recordFile.discard( headerBuf );
+        recordFile.rollback();
         // and obtain it again
-        headerBuf = file.get( 0 );
+        headerBuf = recordFile.get( 0 );
         
         if ( headerBuf.readShort( 0 ) == 0 )
         {
@@ -322,19 +324,24 @@ final class PageManager 
      */
     void close() throws IOException 
     {   
-        file.release( headerBuf );
-        file.commit();
+        recordFile.release( headerBuf );
+        recordFile.commit();
         headerBuf = null;
         header = null;
-        file = null;
+        recordFile = null;
     }
     
     
     /**
-     *  Returns the file header.
+     *  Returns the recordFile header.
      */
     FileHeader getFileHeader() 
     {
         return header;
     }    
+    
+    RecordFile getRecordFile()
+    {
+        return recordFile;
+    }
 }
\ No newline at end of file

Modified: directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/PhysicalRowIdManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/PhysicalRowIdManager.java?rev=943719&r1=943718&r2=943719&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/PhysicalRowIdManager.java (original)
+++ directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/PhysicalRowIdManager.java Wed May 12 22:17:35 2010
@@ -57,19 +57,19 @@ final class PhysicalRowIdManager
 {
     // The file we're talking to and the associated page manager.
     private RecordFile file;
-    private PageManager pageman;
+    private PageManager pageManager;
     private FreePhysicalRowIdPageManager freeman;
 
     /**
      *  Creates a new rowid manager using the indicated record file.
      *  and page manager.
      */
-    PhysicalRowIdManager( RecordFile file, PageManager pageManager )
+    PhysicalRowIdManager( PageManager pageManager )
         throws IOException
     {
-        this.file = file;
-        this.pageman = pageManager;
-        this.freeman = new FreePhysicalRowIdPageManager(file, pageman);
+        this.pageManager = pageManager;
+        this.file = pageManager.getRecordFile();
+        this.freeman = new FreePhysicalRowIdPageManager( pageManager );
     }
 
     /**
@@ -91,15 +91,16 @@ final class PhysicalRowIdManager
         throws IOException
     {
         // fetch the record header
-        BlockIo block = file.get( rowid.getBlock() );
+        BlockIo block = pageManager.getRecordFile().get( rowid.getBlock() );
         RecordHeader head = new RecordHeader( block, rowid.getOffset() );
+        
         if ( length > head.getAvailableSize() ) {
             // not enough space - we need to copy to a new rowid.
-            file.release( block );
+            pageManager.getRecordFile().release( block );
             free( rowid );
             rowid = alloc( length );
         } else {
-            file.release( block );
+            pageManager.getRecordFile().release( block );
         }
 
         // 'nuff space, write it in and return the rowid.
@@ -123,7 +124,7 @@ final class PhysicalRowIdManager
         throws IOException 
     {
         // fetch the record header
-        PageCursor curs = new PageCursor( pageman, rowid.getBlock() );
+        PageCursor curs = new PageCursor( pageManager, rowid.getBlock() );
         BlockIo block = file.get( curs.getCurrent() );
         RecordHeader head = new RecordHeader( block, rowid.getOffset() );
 
@@ -173,7 +174,7 @@ final class PhysicalRowIdManager
         Location retval = freeman.get( size );
         if ( retval == null ) {
             // temporary work around for DIRSERVER-1459
-            retval = allocNew( size * 2, pageman.getLast( Magic.USED_PAGE ) );
+            retval = allocNew( size * 2, pageManager.getLast( Magic.USED_PAGE ) );
         }
         return retval;
     }
@@ -190,7 +191,7 @@ final class PhysicalRowIdManager
         DataPage curPage;
         if ( start == 0 ) {
             // we need to create a new page.
-            start = pageman.allocate( Magic.USED_PAGE );
+            start = pageManager.allocate( Magic.USED_PAGE );
             curBlock = file.get( start );
             curPage = DataPage.getDataPageView( curBlock );
             curPage.setFirst( DataPage.O_DATA );
@@ -249,7 +250,7 @@ final class PhysicalRowIdManager
             int neededLeft = size - freeHere;
             // Refactor these two blocks!
             while ( neededLeft >= DataPage.DATA_PER_PAGE ) {
-                start = pageman.allocate( Magic.USED_PAGE );
+                start = pageManager.allocate( Magic.USED_PAGE );
                 curBlock = file.get( start );
                 curPage = DataPage.getDataPageView( curBlock );
                 curPage.setFirst( (short) 0 ); // no rowids, just data
@@ -258,7 +259,7 @@ final class PhysicalRowIdManager
             }
             if ( neededLeft > 0 ) {
                 // done with whole chunks, allocate last fragment.
-                start = pageman.allocate( Magic.USED_PAGE );
+                start = pageManager.allocate( Magic.USED_PAGE );
                 curBlock = file.get( start );
                 curPage = DataPage.getDataPageView( curBlock );
                 curPage.setFirst( (short) (DataPage.O_DATA + neededLeft) );
@@ -299,7 +300,7 @@ final class PhysicalRowIdManager
     private void write(Location rowid, byte[] data, int start, int length )
         throws IOException
     {
-        PageCursor curs = new PageCursor( pageman, rowid.getBlock() );
+        PageCursor curs = new PageCursor( pageManager, rowid.getBlock() );
         BlockIo block = file.get( curs.getCurrent() );
         RecordHeader hdr = new RecordHeader( block, rowid.getOffset() );
         hdr.setCurrentSize( length );



Mime
View raw message