directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1311757 - in /directory/apacheds/branches/index-work/protocol-ldap/src/main/java/org/apache/directory/server/ldap: LdapSession.java handlers/UnbindHandler.java
Date Tue, 10 Apr 2012 14:33:02 GMT
Author: elecharny
Date: Tue Apr 10 14:33:02 2012
New Revision: 1311757

URL: http://svn.apache.org/viewvc?rev=1311757&view=rev
Log:
Close the pending cursors for pending PagedSearch when the session is unbound

Modified:
    directory/apacheds/branches/index-work/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapSession.java
    directory/apacheds/branches/index-work/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/UnbindHandler.java

Modified: directory/apacheds/branches/index-work/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapSession.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/index-work/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapSession.java?rev=1311757&r1=1311756&r2=1311757&view=diff
==============================================================================
--- directory/apacheds/branches/index-work/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapSession.java
(original)
+++ directory/apacheds/branches/index-work/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapSession.java
Tue Apr 10 14:33:02 2012
@@ -31,6 +31,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.filtering.EntryFilteringCursor;
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.server.ldap.handlers.controls.PagedSearchContext;
+import org.apache.directory.shared.ldap.model.cursor.Cursor;
 import org.apache.directory.shared.ldap.model.message.AbandonableRequest;
 import org.apache.directory.shared.ldap.model.message.BindStatus;
 import org.apache.mina.core.session.IoSession;
@@ -458,6 +459,26 @@ public class LdapSession
         return pagedSearchContexts.remove( contextId );
     }
 
+    
+    /**
+     * Close all the pending cursors for all the pending PagedSearches
+     * 
+     * @throws Exception If we've got an exception.
+     */
+    public void closeAllPagedSearches() throws Exception
+    {
+        for ( int contextId : pagedSearchContexts.keySet() )
+        {
+            PagedSearchContext context = pagedSearchContexts.get( contextId );
+            
+            EntryFilteringCursor cursor = context.getCursor();
+            
+            if ( cursor != null )
+            {
+                cursor.close();
+            }
+        }
+    }
 
     /**
      * Get paged search context associated with an ID 

Modified: directory/apacheds/branches/index-work/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/UnbindHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/index-work/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/UnbindHandler.java?rev=1311757&r1=1311756&r2=1311757&view=diff
==============================================================================
--- directory/apacheds/branches/index-work/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/UnbindHandler.java
(original)
+++ directory/apacheds/branches/index-work/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/UnbindHandler.java
Tue Apr 10 14:33:02 2012
@@ -45,6 +45,7 @@ public class UnbindHandler extends LdapR
 
         try
         {
+            session.closeAllPagedSearches();
             session.getCoreSession().unbind( unbindRequest );
             session.getIoSession().close( true );
             ldapServer.getLdapSessionManager().removeLdapSession( session.getIoSession()
);



Mime
View raw message