From 8d7d9884f8aa54e7dce86ecdb627e9f0d8f5cd1c Mon Sep 17 00:00:00 2001
From: vharseko <vharseko@openam.org.ru>
Date: Fri, 26 Oct 2018 19:57:53 +0000
Subject: [PATCH] PooledMemoryManager to default settings

---
 opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/ServerTCPNIOTransport.java |   19 +------------------
 1 files changed, 1 insertions(+), 18 deletions(-)

diff --git a/opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/ServerTCPNIOTransport.java b/opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/ServerTCPNIOTransport.java
index 5e6c1b6..4329cc4 100644
--- a/opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/ServerTCPNIOTransport.java
+++ b/opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/ServerTCPNIOTransport.java
@@ -37,7 +37,6 @@
 
     private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
     static final ServerTCPNIOTransport SERVER_TRANSPORT = new ServerTCPNIOTransport();
-    private static final long MB = 1024 * 1024;
 
     private ServerTCPNIOTransport() {
         // Prevent instantiation.
@@ -98,24 +97,8 @@
             // Enabled by default.
             builder.setReuseAddress(Boolean.parseBoolean(reuseAddressStr));
         }
-        float heapPercent;
-        if (Runtime.getRuntime().maxMemory() < 1024 * MB) {
-            // Low heap
-            heapPercent = 0.01f;
-        } else {
-            // Compute a percentage to try to reach roughly 64Mb (big enough (tm))
-            heapPercent = 64f * MB / Runtime.getRuntime().maxMemory();
-        }
         // Force usage of PooledMemoryManager which allows to use grizzly's buffers across threads.
-        builder.setMemoryManager(new PooledMemoryManager(
-                1024,  // Initial buffer size
-                3,     // Number of pools (with growing factor below this give us pools of 1K, 4K, 16k buffers)
-                4,     // Growing factor to apply on the size of the buffer polled by the next pool
-                selectorThreadCount,    // Number of pool slices that every pool will stripe allocation requests across
-                heapPercent, // The percentage of the heap that this manager will use when populating the pools (5%)
-                1f,    // The percentage of buffers to be pre-allocated during MemoryManager initialization (100%)
-                true   // true to use direct buffers or false to use heap buffers
-        ));
+        builder.setMemoryManager(new PooledMemoryManager(true));
 
         final TCPNIOTransport transport = builder.build();
 

--
Gitblit v1.10.0