From dc0b97516ea3c05cd6cc988a9120faecb0de675c Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Tue, 01 Aug 2006 04:34:18 +0000
Subject: [PATCH] Fix a bug in which it was possible to dynamically disable a connection handler but it could not be re-enabled.  The reason for this is that when the connection handler was re-enabled the associated thread was not started.

---
 opends/src/server/org/opends/server/protocols/ldap/LDAPRequestHandler.java |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/opends/src/server/org/opends/server/protocols/ldap/LDAPRequestHandler.java b/opends/src/server/org/opends/server/protocols/ldap/LDAPRequestHandler.java
index d22cf50..a749494 100644
--- a/opends/src/server/org/opends/server/protocols/ldap/LDAPRequestHandler.java
+++ b/opends/src/server/org/opends/server/protocols/ldap/LDAPRequestHandler.java
@@ -39,6 +39,8 @@
 
 import org.opends.server.api.ConnectionSecurityProvider;
 import org.opends.server.api.DirectoryThread;
+import org.opends.server.api.ServerShutdownListener;
+import org.opends.server.core.DirectoryServer;
 import org.opends.server.core.InitializationException;
 
 import static org.opends.server.loggers.Debug.*;
@@ -61,6 +63,7 @@
  */
 public class LDAPRequestHandler
        extends DirectoryThread
+       implements ServerShutdownListener
 {
   /**
    * The fully-qualified name of this class for debugging purposes.
@@ -423,6 +426,35 @@
 
 
   /**
+   * Retrieves the human-readable name for this shutdown listener.
+   *
+   * @return  The human-readable name for this shutdown listener.
+   */
+  public String getShutdownListenerName()
+  {
+    assert debugEnter(CLASS_NAME, "getShutdownListenerName");
+
+    return handlerName;
+  }
+
+
+
+  /**
+   * Causes this request handler to register itself as a shutdown listener with
+   * the Directory Server.  This must be called if the connection handler is
+   * shut down without closing all associated connections, otherwise the thread
+   * would not be stopped by the server.
+   */
+  public void registerShutdownListener()
+  {
+    assert debugEnter(CLASS_NAME, "registerShutdownListener");
+
+    DirectoryServer.registerShutdownListener(this);
+  }
+
+
+
+  /**
    * Indicates that the Directory Server has received a request to stop running
    * and that this shutdown listener should take any action necessary to prepare
    * for it.

--
Gitblit v1.10.0