directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r918138 - /directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/SearchCursor.java
Date Tue, 02 Mar 2010 18:35:38 GMT
Author: kayyagari
Date: Tue Mar  2 18:35:38 2010
New Revision: 918138

URL: http://svn.apache.org/viewvc?rev=918138&view=rev
Log:
o added a global flag to detect the completion of the search operation
o fixed the close() method

Modified:
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/SearchCursor.java

Modified: directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/SearchCursor.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/SearchCursor.java?rev=918138&r1=918137&r2=918138&view=diff
==============================================================================
--- directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/SearchCursor.java
(original)
+++ directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/SearchCursor.java
Tue Mar  2 18:35:38 2010
@@ -54,6 +54,7 @@
     /** a reference to hold the retrieved SearchResponse object from SearchFuture */
     private SearchResponse response;
 
+    private boolean done;
 
     public SearchCursor( SearchFuture future, long timeout, TimeUnit timeUnit )
     {
@@ -93,7 +94,7 @@
             throw new LdapException( LdapConnection.TIME_OUT_ERROR );
         }
 
-        boolean done = ( response instanceof SearchResultDone );
+        done = ( response instanceof SearchResultDone );
 
         if ( done )
         {
@@ -137,6 +138,12 @@
     @Override
     public void close( Exception cause ) throws Exception
     {
+        if( done )
+        {
+            super.close();
+            return;
+        }
+        
         if ( !future.isCancelled() )
         {
             future.cancel( true );



Mime
View raw message