directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r650347 - /directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursor.java
Date Tue, 22 Apr 2008 01:30:32 GMT
Author: akarasulu
Date: Mon Apr 21 18:30:29 2008
New Revision: 650347

URL: http://svn.apache.org/viewvc?rev=650347&view=rev
Log:
fix bug with browser unresponsiveness when switching direction

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

Modified: directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursor.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/DupsContainerCursor.java?rev=650347&r1=650346&r2=650347&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursor.java
(original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursor.java
Mon Apr 21 18:30:29 2008
@@ -43,6 +43,7 @@
     private Tuple<K,DupsContainer<V>> returnedTuple = new Tuple<K,DupsContainer<V>>();
     private TupleBrowser browser;
     private boolean valueAvailable;
+    private Boolean forwardDirection;
 
 
     /**
@@ -113,6 +114,12 @@
             if ( nextCompared > 0 )
             {
                 browser.getPrevious( jdbmTuple );
+
+                // switch in direction bug workaround: when a JDBM browser
+                // switches direction with next then previous as is occuring
+                // here then two previous moves are needed.
+                browser.getPrevious( jdbmTuple );
+                forwardDirection = false;
                 clearValue();
                 return;
             }
@@ -157,7 +164,20 @@
             afterLast();
         }
 
-        if ( browser.getPrevious( jdbmTuple ) )
+        boolean advanceSuccess = browser.getPrevious( jdbmTuple );
+
+        if ( forwardDirection == null )
+        {
+            forwardDirection = false;
+        }
+
+        if ( forwardDirection )
+        {
+            advanceSuccess = browser.getPrevious( jdbmTuple );
+            forwardDirection = false;
+        }
+
+        if ( advanceSuccess )
         {
             //noinspection unchecked
             returnedTuple.setKey( ( K ) jdbmTuple.getKey() );
@@ -179,7 +199,20 @@
             beforeFirst();
         }
 
-        if ( browser.getNext( jdbmTuple ) )
+        boolean advanceSuccess = browser.getNext( jdbmTuple );
+
+        if ( forwardDirection == null )
+        {
+            forwardDirection = true;
+        }
+
+        if ( ! forwardDirection )
+        {
+            advanceSuccess = browser.getNext( jdbmTuple );
+            forwardDirection = true;
+        }
+
+        if ( advanceSuccess )
         {
             //noinspection unchecked
             returnedTuple.setKey( ( K ) jdbmTuple.getKey() );



Mime
View raw message