From 332dcba0b9acaab991911fdd8aed6c3e2615e088 Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Fri, 17 Sep 2010 22:46:18 +0000
Subject: [PATCH] Refactor configuration of maximum persistent search resource limits

---
 opends/src/server/org/opends/server/core/DirectoryServer.java |   24 ++++++++++++++++++++----
 1 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/opends/src/server/org/opends/server/core/DirectoryServer.java b/opends/src/server/org/opends/server/core/DirectoryServer.java
index a6317bf..e5f121d 100644
--- a/opends/src/server/org/opends/server/core/DirectoryServer.java
+++ b/opends/src/server/org/opends/server/core/DirectoryServer.java
@@ -616,6 +616,9 @@
   // The current active persistent searches.
   private AtomicInteger activePSearches = new AtomicInteger(0);
 
+  //The maximum number of concurrent persistent searches.
+  private int maxPSearches;
+
   // Whether to use collect operation processing times in nanosecond resolution
   private boolean useNanoTime;
 
@@ -8872,6 +8875,20 @@
 
 
   /**
+   * Specifies the maximum number of simultaneous persistent
+   * searches that are allowed.
+   *
+   * @param maxPSearches   The maximum number of simultaneous persistent
+  *                      searches that are allowed.
+   */
+  public static void setMaxPersistentSearchLimit(int maxPSearches)
+  {
+    directoryServer.maxPSearches = maxPSearches;
+  }
+
+
+
+  /**
    *  Registers a new persistent search by increasing the count
    *  of active persistent searches. After receiving a persistent
    *  search request, a Local or Remote WFE must call this method to
@@ -8906,11 +8923,10 @@
    */
   public static boolean allowNewPersistentSearch()
   {
-    //0 indicates that there is no limit.
-    int maxAllowedPSearch = getWorkQueue().getMaxPersistentSearchLimit();
-    if(maxAllowedPSearch ==0 ||
+    //-1 indicates that there is no limit.
+    if(directoryServer.maxPSearches ==-1 ||
             directoryServer.activePSearches.get() <
-            maxAllowedPSearch)
+            directoryServer.maxPSearches)
     {
       return true;
     }

--
Gitblit v1.10.0