From 3384638f67ebb7895dd095433d1380dde0b40f3d Mon Sep 17 00:00:00 2001
From: Yannick Lecaillez <yannick.lecaillez@forgerock.com>
Date: Mon, 07 Nov 2016 13:59:40 +0000
Subject: [PATCH] OPENDJ-3179: Migrate LDAP Connection Handler to SDK Grizzly transport

---
 opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/DefaultTCPNIOTransport.java |   39 ++-------------------------------------
 1 files changed, 2 insertions(+), 37 deletions(-)

diff --git a/opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/DefaultTCPNIOTransport.java b/opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/DefaultTCPNIOTransport.java
index 0332452..a06456c 100644
--- a/opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/DefaultTCPNIOTransport.java
+++ b/opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/DefaultTCPNIOTransport.java
@@ -23,7 +23,6 @@
 import org.glassfish.grizzly.nio.transport.TCPNIOTransport;
 import org.glassfish.grizzly.nio.transport.TCPNIOTransportBuilder;
 import org.glassfish.grizzly.strategies.SameThreadIOStrategy;
-import org.glassfish.grizzly.strategies.WorkerThreadIOStrategy;
 import org.glassfish.grizzly.threadpool.ThreadPoolConfig;
 
 import com.forgerock.opendj.util.ReferenceCountedObject;
@@ -56,24 +55,7 @@
     protected TCPNIOTransport newInstance() {
         final TCPNIOTransportBuilder builder = TCPNIOTransportBuilder.newInstance();
 
-        /*
-         * Determine which threading strategy to use, and total number of
-         * threads.
-         */
-        final String useWorkerThreadsStr =
-                System.getProperty("org.forgerock.opendj.transport.useWorkerThreads");
-        final boolean useWorkerThreadStrategy;
-        if (useWorkerThreadsStr != null) {
-            useWorkerThreadStrategy = Boolean.parseBoolean(useWorkerThreadsStr);
-        } else {
-            useWorkerThreadStrategy = false;
-        }
-
-        if (useWorkerThreadStrategy) {
-            builder.setIOStrategy(WorkerThreadIOStrategy.getInstance());
-        } else {
-            builder.setIOStrategy(SameThreadIOStrategy.getInstance());
-        }
+        builder.setIOStrategy(SameThreadIOStrategy.getInstance());
 
         // Calculate thread counts.
         final int cpus = Runtime.getRuntime().availableProcessors();
@@ -85,30 +67,13 @@
         if (selectorsStr != null) {
             selectorThreadCount = Integer.parseInt(selectorsStr);
         } else {
-            selectorThreadCount =
-                    useWorkerThreadStrategy ? Math.max(2, cpus / 4) : Math.max(5, (cpus / 2) - 1);
+            selectorThreadCount = Math.max(5, (cpus / 2) - 1);
         }
 
         builder.setSelectorThreadPoolConfig(ThreadPoolConfig.defaultConfig().setCorePoolSize(
                 selectorThreadCount).setMaxPoolSize(selectorThreadCount).setPoolName(
                 "OpenDJ LDAP SDK Grizzly selector thread"));
 
-        // Calculate the number of worker threads.
-        if (builder.getWorkerThreadPoolConfig() != null) {
-            final String workersStr = System.getProperty("org.forgerock.opendj.transport.workers");
-            final int workerThreadCount;
-
-            if (workersStr != null) {
-                workerThreadCount = Integer.parseInt(workersStr);
-            } else {
-                workerThreadCount = useWorkerThreadStrategy ? Math.max(5, (cpus * 2)) : 0;
-            }
-
-            builder.setWorkerThreadPoolConfig(ThreadPoolConfig.defaultConfig().setCorePoolSize(
-                    workerThreadCount).setMaxPoolSize(workerThreadCount).setPoolName(
-                    "OpenDJ LDAP SDK Grizzly worker thread"));
-        }
-
         // Parse IO related options.
         final String lingerStr = System.getProperty("org.forgerock.opendj.transport.linger");
         if (lingerStr != null) {

--
Gitblit v1.10.0