Improved the SearchFuture class, implementing the isDone() method.

git-svn-id: https://svn.apache.org/repos/asf/directory/shared/branches/shared-replication@772444 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/future/SearchFuture.java b/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/future/SearchFuture.java
index bbbbe23..fba327a 100644
--- a/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/future/SearchFuture.java
+++ b/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/future/SearchFuture.java
@@ -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;
     }
 }