directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r636272 - /directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
Date Wed, 12 Mar 2008 10:24:31 GMT
Author: akarasulu
Date: Wed Mar 12 03:24:24 2008
New Revision: 636272

URL: http://svn.apache.org/viewvc?rev=636272&view=rev
Log:
using LRU map instead of plain map for duplicate BTree cache

Modified:
    directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java

Modified: directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java?rev=636272&r1=636271&r2=636272&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
(original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
Wed Mar 12 03:24:24 2008
@@ -31,6 +31,7 @@
 import org.apache.directory.server.core.cursor.Cursor;
 import org.apache.directory.server.core.partition.impl.btree.*;
 import org.apache.directory.server.schema.SerializableComparator;
+import org.apache.directory.shared.ldap.util.SynchronizedLRUMap;
 
 import java.io.IOException;
 import java.util.*;
@@ -68,8 +69,8 @@
     private TupleRenderer renderer;
     /** the limit at which we start using btree redirection for duplicates */
     private int numDupLimit = JdbmIndex.DEFAULT_DUPLICATE_LIMIT;
-    /** @TODO should really be a cache of duplicate BTrees */
-    private Map<Long, BTree> duplicateBtrees = new HashMap<Long, BTree>();
+    /** a cache of duplicate BTrees */
+    private final Map<Long, BTree> duplicateBtrees;
     
     AvlTreeMarshaller<V> marshaller;
 
@@ -112,11 +113,18 @@
 
         if( allowsDuplicates )
         {
+            // TODO make the size of the duplicate btree cache configurable via constructor
+            //noinspection unchecked
+            duplicateBtrees = new SynchronizedLRUMap( 100 );
             //TODO the IntegerKeyMarshaller should be replaced with the appropriate marshaller
for type V
             marshaller = new AvlTreeMarshaller<V>( comparator.getValueComparator(),
                     new MarshallerSerializerBridge<V>( valueSerializer ) );
             // the value serializer causes problems between BTree and AvlTree cause each
use it in a different way
             valueSerializer = null; // set this to null
+        }
+        else
+        {
+            duplicateBtrees = null;
         }
         
         this.numDupLimit = numDupLimit;



Mime
View raw message