From 710d8dc12afc3befff667f2e8096ad187dc79443 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Fri, 02 Dec 2011 10:06:04 +0000
Subject: [PATCH] Fix OPENDJ-374: Remove BlockingQueue parameter from Connection.search(SearchRequest, BlockingQueue)

---
 opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/ConnectionDecorator.java |    6 ++----
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Connection.java          |   18 ++++++++----------
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/FixedConnectionPool.java |    6 ++----
 opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractConnection.java  |   10 +++-------
 4 files changed, 15 insertions(+), 25 deletions(-)

diff --git a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/ConnectionDecorator.java b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/ConnectionDecorator.java
index 3006e28..b266a98 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/ConnectionDecorator.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/util/ConnectionDecorator.java
@@ -31,7 +31,6 @@
 
 
 import java.util.Collection;
-import java.util.concurrent.BlockingQueue;
 
 import org.forgerock.i18n.LocalizedIllegalArgumentException;
 import org.forgerock.opendj.ldap.*;
@@ -604,12 +603,11 @@
    * The default implementation is to delegate.
    */
   @Override
-  public ConnectionEntryReader search(final SearchRequest request,
-      final BlockingQueue<Response> entries)
+  public ConnectionEntryReader search(final SearchRequest request)
       throws UnsupportedOperationException, IllegalStateException,
       NullPointerException
   {
-    return connection.search(request, entries);
+    return connection.search(request);
   }
 
 
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractConnection.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractConnection.java
index 869c71d..e6e7726 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractConnection.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractConnection.java
@@ -36,8 +36,6 @@
 import static org.forgerock.opendj.ldap.ErrorResultException.newErrorResult;
 
 import java.util.Collection;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 
@@ -490,12 +488,11 @@
    * {@inheritDoc}
    */
   @Override
-  public ConnectionEntryReader search(final SearchRequest request,
-      final BlockingQueue<Response> entries)
+  public ConnectionEntryReader search(final SearchRequest request)
       throws UnsupportedOperationException, IllegalStateException,
       NullPointerException
   {
-    return new ConnectionEntryReader(this, request, entries);
+    return new ConnectionEntryReader(this, request);
   }
 
 
@@ -589,10 +586,9 @@
       throws UnsupportedOperationException, IllegalStateException,
       NullPointerException
   {
-    final BlockingQueue<Response> entries = new LinkedBlockingQueue<Response>();
     final SearchRequest request = Requests.newSearchRequest(baseObject, scope,
         filter, attributeDescriptions);
-    return search(request, entries);
+    return search(request);
   }
 
 
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Connection.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Connection.java
index 697f44a..e352069 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Connection.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/Connection.java
@@ -32,7 +32,6 @@
 
 import java.io.Closeable;
 import java.util.Collection;
-import java.util.concurrent.BlockingQueue;
 
 import org.forgerock.i18n.LocalizedIllegalArgumentException;
 import org.forgerock.opendj.ldap.requests.*;
@@ -1125,16 +1124,15 @@
   /**
    * Searches the Directory Server using the provided search parameters. Any
    * matching entries returned by the search will be exposed through the
-   * {@code EntryReader} interface.
+   * returned {@code ConnectionEntryReader}.
    * <p>
-   * <b>Warning:</b> When using a queue with an optional capacity bound, the
-   * connection will stop reading responses and wait if necessary for space to
-   * become available.
+   * Unless otherwise specified, calling this method is equivalent to:
+   * <pre>
+   * ConnectionEntryReader reader = new ConnectionEntryReader(this, request);
+   * </pre>
    *
    * @param request
    *          The search request.
-   * @param entries
-   *          The queue to which matching entries should be added.
    * @return The result of the operation.
    * @throws UnsupportedOperationException
    *           If this connection does not support search operations.
@@ -1144,9 +1142,9 @@
    * @throws NullPointerException
    *           If {@code request} or {@code entries} was {@code null}.
    */
-  ConnectionEntryReader search(SearchRequest request,
-      BlockingQueue<Response> entries) throws UnsupportedOperationException,
-      IllegalStateException, NullPointerException;
+  ConnectionEntryReader search(SearchRequest request)
+      throws UnsupportedOperationException, IllegalStateException,
+      NullPointerException;
 
 
 
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/FixedConnectionPool.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/FixedConnectionPool.java
index 6b2be72..8da8ba9 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/FixedConnectionPool.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/FixedConnectionPool.java
@@ -35,7 +35,6 @@
 import java.util.Collection;
 import java.util.LinkedList;
 import java.util.List;
-import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.Semaphore;
 import java.util.concurrent.atomic.AtomicBoolean;
@@ -568,12 +567,11 @@
 
 
     @Override
-    public ConnectionEntryReader search(final SearchRequest request,
-        final BlockingQueue<Response> entries)
+    public ConnectionEntryReader search(final SearchRequest request)
         throws UnsupportedOperationException, IllegalStateException,
         NullPointerException
     {
-      return checkState().search(request, entries);
+      return checkState().search(request);
     }
 
 

--
Gitblit v1.10.0