directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r772444 - /directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/future/SearchFuture.java
Date Wed, 06 May 2009 22:03:22 GMT
Author: elecharny
Date: Wed May  6 22:03:22 2009
New Revision: 772444

URL: http://svn.apache.org/viewvc?rev=772444&view=rev
Log:
Improved the SearchFuture class, implementing the isDone() method.

Modified:
    directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/future/SearchFuture.java

Modified: directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/future/SearchFuture.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/future/SearchFuture.java?rev=772444&r1=772443&r2=772444&view=diff
==============================================================================
--- directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/future/SearchFuture.java
(original)
+++ directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/future/SearchFuture.java
Wed May  6 22:03:22 2009
@@ -26,6 +26,7 @@
 import java.util.concurrent.TimeoutException;
 
 import org.apache.directory.shared.ldap.client.api.messages.Response;
+import org.apache.directory.shared.ldap.client.api.messages.SearchResultDone;
 
 /**
  * A Future to manage SearchRequest. The searchResponseQueue contains
@@ -40,6 +41,8 @@
     /** The queue where SearchResponse are stored */
     private BlockingQueue<Response> searchResponseQueue;
     
+    /** A flag set to true when the searchResultDone has been received */
+    private boolean done = false;
    
     /**
      * 
@@ -72,7 +75,14 @@
      */
     public Response get() throws InterruptedException, ExecutionException
     {
-        return searchResponseQueue.poll();
+        Response response = searchResponseQueue.take();
+        
+        if ( response instanceof SearchResultDone )
+        {
+            done = true;
+        }
+        
+        return response;
     }
 
     
@@ -106,6 +116,6 @@
      */
     public boolean isDone()
     {
-        throw new RuntimeException( "Not Yet Implemented" );
+        return done;
     }
 }



Mime
View raw message