From 0835b4c505656b924029c41246316a8375f7b5f9 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Thu, 05 Apr 2007 22:42:35 +0000
Subject: [PATCH] Update the server so that it is possible to start in a mode in which the server is completely functional but does not accept connections from external clients. This will be available if the org.opends.server.DisableConnectionHandlers property is set with a value of "true".

---
 opendj-sdk/opends/src/server/org/opends/server/core/DirectoryServer.java |   20 +++++++++++++++++---
 opendj-sdk/opends/src/server/org/opends/server/util/ServerConstants.java |   11 +++++++++++
 2 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/DirectoryServer.java b/opendj-sdk/opends/src/server/org/opends/server/core/DirectoryServer.java
index eb9f952..0bb1d84 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/DirectoryServer.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/DirectoryServer.java
@@ -967,6 +967,14 @@
       }
 
 
+      // Determine whether or not we should start the connection handlers.
+      String disableProperty =
+                  System.getProperty(PROPERTY_DISABLE_CONNECTION_HANDLERS);
+      boolean startConnectionHandlers =
+                   ((disableProperty == null) ||
+                    (! disableProperty.equalsIgnoreCase("true")));
+
+
       // Initialize all the schema elements.
       initializeSchema();
 
@@ -1052,7 +1060,10 @@
 
 
       // Initialize all the connection handlers.
-      initializeConnectionHandlers();
+      if (startConnectionHandlers)
+      {
+        initializeConnectionHandlers();
+      }
 
 
       // Initialize all the monitor providers.
@@ -1093,9 +1104,12 @@
 
       // At this point, we should be ready to go.  Start all the connection
       // handlers.
-      for (ConnectionHandler c : connectionHandlers)
+      if (startConnectionHandlers)
       {
-        c.start();
+        for (ConnectionHandler c : connectionHandlers)
+        {
+          c.start();
+        }
       }
 
 
diff --git a/opendj-sdk/opends/src/server/org/opends/server/util/ServerConstants.java b/opendj-sdk/opends/src/server/org/opends/server/util/ServerConstants.java
index 990b2b6..57ebefc 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/util/ServerConstants.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/util/ServerConstants.java
@@ -2236,6 +2236,17 @@
 
 
   /**
+   * The name of the system property that can be used to disable any connection
+   * handler that may be enabled in the server configuration.  This may be used
+   * to start the server in a mode where it will not accept any external
+   * connections, but may still be used for processing internal operations.
+   */
+  public static final String PROPERTY_DISABLE_CONNECTION_HANDLERS =
+       "org.opends.server.DisableConnectionHandlers";
+
+
+
+  /**
    * The name of the system property that can be used to indicate whether
    * components should be allowed to use the <CODE>Runtime.exec</CODE> method.
    * If this property is set and the value is anything other than "false",

--
Gitblit v1.10.0