You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2013/08/03 11:04:17 UTC

svn commit: r1509947 - /directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotTable.java

Author: elecharny
Date: Sat Aug  3 09:04:17 2013
New Revision: 1509947

URL: http://svn.apache.org/r1509947
Log:
Made the valueCursor() method to get the values directly, without testing about their existence, to spare a search in the underlying database.

Modified:
    directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotTable.java

Modified: directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotTable.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotTable.java?rev=1509947&r1=1509946&r2=1509947&view=diff
==============================================================================
--- directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotTable.java (original)
+++ directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotTable.java Sat Aug  3 09:04:17 2013
@@ -316,20 +316,6 @@ public class MavibotTable<K, V> extends 
         {
             throw new LdapException( e );
         }
-
-        //        try
-        //        {
-        //            if ( bt.hasKey( key ) )
-        //            {
-        //                return bt.get( key );
-        //            }
-        //        }
-        //        catch ( Exception e )
-        //        {
-        //            throw new LdapException( e );
-        //        }
-        //
-        //        return null;
     }
 
 
@@ -455,30 +441,6 @@ public class MavibotTable<K, V> extends 
     }
 
 
-    /*
-                if ( !bt.hasKey( key ) )
-            {
-                return new EmptyCursor<Tuple<K, V>>();
-            }
-
-            if ( !allowsDuplicates )
-            {
-                V val = bt.get( key );
-                return new SingletonCursor<Tuple<K, V>>(
-                    new Tuple<K, V>( key, val ) );
-            }
-
-            BTree<V, V> dups = bt.getValues( key );
-
-            return new KeyTupleArrayCursor<K, V>( dups, key );
-        }
-        catch ( Exception e )
-        {
-            throw new LdapException( e );
-        }
-    }
-    */
-
     @Override
     public Cursor<V> valueCursor( K key ) throws Exception
     {
@@ -489,20 +451,22 @@ public class MavibotTable<K, V> extends 
 
         try
         {
-            if ( !bt.hasKey( key ) )
-            {
-                return new EmptyCursor<V>();
-            }
-
             if ( !allowsDuplicates )
             {
                 V val = bt.get( key );
+
                 return new SingletonCursor<V>( val );
             }
+            else
+            {
+                BTree<V, V> dups = bt.getValues( key );
 
-            BTree<V, V> dups = bt.getValues( key );
-
-            return new ValueTreeCursor<V>( dups );
+                return new ValueTreeCursor<V>( dups );
+            }
+        }
+        catch ( KeyNotFoundException knfe )
+        {
+            return new EmptyCursor<V>();
         }
         catch ( Exception e )
         {