From 20b30000c1266606a8cdae50a79982f415f11286 Mon Sep 17 00:00:00 2001
From: Ludovic Poitou <ludovic.poitou@forgerock.com>
Date: Wed, 22 Dec 2010 12:06:31 +0000
Subject: [PATCH] Ensure that correct Grizzly MemoryManager is used for SASL and ASN1 filters.

---
 opendj-sdk/sdk/src/com/sun/opends/sdk/tools/ModRate.java |   41 +++++++++++++++++++++--------------------
 1 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/opendj-sdk/sdk/src/com/sun/opends/sdk/tools/ModRate.java b/opendj-sdk/sdk/src/com/sun/opends/sdk/tools/ModRate.java
index 360f490..664da15 100644
--- a/opendj-sdk/sdk/src/com/sun/opends/sdk/tools/ModRate.java
+++ b/opendj-sdk/sdk/src/com/sun/opends/sdk/tools/ModRate.java
@@ -52,7 +52,7 @@
 {
   private static final class ModifyPerformanceRunner extends PerformanceRunner
   {
-    private final class ModifyWorkerThread extends WorkerThread
+    private final class ModifyWorkerThread extends ConnectionWorker
     {
       private ModifyRequest mr;
       private Object[] data;
@@ -70,15 +70,15 @@
       @Override
       public FutureResult<?> performOperation(
           final AsynchronousConnection connection,
-          final DataSource[] dataSources, long startTime)
+          final DataSource[] dataSources, final long startTime)
       {
         if (dataSources != null)
         {
           data = DataSource.generateData(dataSources, data);
         }
         mr = newModifyRequest(data);
-        return connection.modify(mr,
-            new UpdateStatsResultHandler<Result>(startTime));
+        return connection.modify(mr, new UpdateStatsResultHandler<Result>(
+            startTime, connection, this));
       }
 
 
@@ -109,9 +109,9 @@
           colonPos = formattedString.indexOf(':');
           if (colonPos > 0)
           {
-            mr.addModification(ModificationType.REPLACE, formattedString
-                .substring(0, colonPos), formattedString
-                .substring(colonPos + 1));
+            mr.addModification(ModificationType.REPLACE,
+                formattedString.substring(0, colonPos),
+                formattedString.substring(colonPos + 1));
           }
         }
         return mr;
@@ -135,18 +135,19 @@
 
 
     @Override
-    StatsThread newStatsThread()
+    ConnectionWorker newConnectionWorker(
+        final AsynchronousConnection connection,
+        final ConnectionFactory connectionFactory)
     {
-      return new StatsThread(new String[0]);
+      return new ModifyWorkerThread(connection, connectionFactory);
     }
 
 
 
     @Override
-    WorkerThread newWorkerThread(final AsynchronousConnection connection,
-        final ConnectionFactory connectionFactory)
+    StatsThread newStatsThread()
     {
-      return new ModifyWorkerThread(connection, connectionFactory);
+      return new StatsThread(new String[0]);
     }
   }
 
@@ -313,8 +314,8 @@
   {
     // Create the command-line argument parser for use with this
     // program.
-    final LocalizableMessage toolDescription =
-        INFO_MODRATE_TOOL_DESCRIPTION.get();
+    final LocalizableMessage toolDescription = INFO_MODRATE_TOOL_DESCRIPTION
+        .get();
     final ArgumentParser argParser = new ArgumentParser(
         ModRate.class.getName(), toolDescription, false, true, 1, 0,
         "[(attribute:value format string) ...]");
@@ -330,8 +331,7 @@
     try
     {
       TransportFactory.setInstance(new PerfToolTCPNIOTransportFactory());
-      connectionFactoryProvider =
-          new ConnectionFactoryProvider(argParser, this);
+      connectionFactoryProvider = new ConnectionFactoryProvider(argParser, this);
       runner = new ModifyPerformanceRunner(argParser, this);
       propertiesFileArgument = new StringArgument("propertiesFilePath", null,
           OPTION_LONG_PROP_FILE_PATH, false, false, true,
@@ -347,8 +347,9 @@
       argParser.setNoPropertiesFileArgument(noPropertiesFileArgument);
 
       baseDN = new StringArgument("targetDN", OPTION_SHORT_BASEDN,
-          OPTION_LONG_TARGETDN, true, false, true, INFO_TARGETDN_PLACEHOLDER.get(),
-          null, null, INFO_MODRATE_TOOL_DESCRIPTION_TARGETDN.get());
+          OPTION_LONG_TARGETDN, true, false, true,
+          INFO_TARGETDN_PLACEHOLDER.get(), null, null,
+          INFO_MODRATE_TOOL_DESCRIPTION_TARGETDN.get());
       baseDN.setPropertyName(OPTION_LONG_BASEDN);
       argParser.addArgument(baseDN);
 
@@ -387,8 +388,8 @@
         return 0;
       }
 
-      connectionFactory =
-          connectionFactoryProvider.getAuthenticatedConnectionFactory();
+      connectionFactory = connectionFactoryProvider
+          .getAuthenticatedConnectionFactory();
       runner.validate();
     }
     catch (final ArgumentException ae)

--
Gitblit v1.10.0