From 32034d853f3a284424ccfa87b6de210f1ca814e1 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Tue, 29 Nov 2011 00:31:21 +0000
Subject: [PATCH] Fix OPENDJ-43 (Synchronous Connection decorator implementations should not use AsynchronousConnections) and OPENDJ-328 (Make it easier to implement connection decorators).

---
 opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/AuthRate.java |   28 ++++++++--------------------
 1 files changed, 8 insertions(+), 20 deletions(-)

diff --git a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/AuthRate.java b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/AuthRate.java
index 75762cf..1ba09f3 100644
--- a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/AuthRate.java
+++ b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/AuthRate.java
@@ -134,7 +134,7 @@
 
 
 
-      private BindWorkerThread(final AsynchronousConnection connection,
+      private BindWorkerThread(final Connection connection,
           final ConnectionFactory connectionFactory)
       {
         super(connection, connectionFactory);
@@ -143,8 +143,7 @@
 
 
       @Override
-      public FutureResult<?> performOperation(
-          final AsynchronousConnection connection,
+      public FutureResult<?> performOperation(final Connection connection,
           final DataSource[] dataSources, final long startTime)
       {
         if (dataSources != null)
@@ -179,7 +178,7 @@
           }
 
           final RecursiveFutureResult<SearchResultEntry, BindResult> future =
-            new RecursiveFutureResult<SearchResultEntry, BindResult>(
+              new RecursiveFutureResult<SearchResultEntry, BindResult>(
               new BindUpdateStatsResultHandler(startTime))
           {
             @Override
@@ -197,7 +196,7 @@
               return performBind(connection, data, resultHandler);
             }
           };
-          connection.searchSingleEntry(sr, future);
+          connection.searchSingleEntryAsync(sr, future);
           return future;
         }
         else
@@ -209,9 +208,8 @@
 
 
 
-      private FutureResult<BindResult> performBind(
-          final AsynchronousConnection connection, final Object[] data,
-          final ResultHandler<? super BindResult> handler)
+      private FutureResult<BindResult> performBind(final Connection connection,
+          final Object[] data, final ResultHandler<? super BindResult> handler)
       {
         final boolean useInvalidPassword;
 
@@ -380,28 +378,20 @@
           }
         }
 
-        return connection.bind(br, handler);
+        return connection.bindAsync(br, null, handler);
       }
     }
 
 
 
     private final AtomicLong searchWaitRecentTime = new AtomicLong();
-
     private final AtomicInteger invalidCredRecentCount = new AtomicInteger();
-
     private String filter;
-
     private String baseDN;
-
     private SearchScope scope;
-
     private DereferenceAliasesPolicy dereferencesAliasesPolicy;
-
     private String[] attributes;
-
     private BindRequest bindRequest;
-
     private int invalidCredPercent;
 
 
@@ -415,8 +405,7 @@
 
 
     @Override
-    WorkerThread newWorkerThread(
-        final AsynchronousConnection connection,
+    WorkerThread newWorkerThread(final Connection connection,
         final ConnectionFactory connectionFactory)
     {
       return new BindWorkerThread(connection, connectionFactory);
@@ -449,7 +438,6 @@
 
 
   private BooleanArgument verbose;
-
   private BooleanArgument scriptFriendly;
 
 

--
Gitblit v1.10.0