From 04e870d40ff37a78f8c89c0a91c479545bc92d4f Mon Sep 17 00:00:00 2001
From: abobrov <abobrov@localhost>
Date: Thu, 14 Feb 2008 01:49:59 +0000
Subject: [PATCH] - followup to [Issue 2877] : Issue with creation of connection handler:   fix various dynamic re/configuration issues.

---
 opendj-sdk/opends/src/server/org/opends/server/protocols/jmx/JmxConnectionHandler.java |   43 ++++++++++++++++++++++++-------------------
 1 files changed, 24 insertions(+), 19 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/protocols/jmx/JmxConnectionHandler.java b/opendj-sdk/opends/src/server/org/opends/server/protocols/jmx/JmxConnectionHandler.java
index 27f62e6..8c951fd 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/protocols/jmx/JmxConnectionHandler.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/protocols/jmx/JmxConnectionHandler.java
@@ -138,8 +138,12 @@
       rmiConnectorRestart = true;
     }
 
-    if (!currentConfig.getSSLCertNickname().equals(
-        config.getSSLCertNickname())) {
+    if (((currentConfig.getSSLCertNickname() != null) &&
+          !currentConfig.getSSLCertNickname().equals(
+          config.getSSLCertNickname())) ||
+        ((config.getSSLCertNickname() != null) &&
+          !config.getSSLCertNickname().equals(
+          currentConfig.getSSLCertNickname()))) {
       rmiConnectorRestart = true;
     }
 
@@ -402,25 +406,26 @@
   {
     JMXConnectionHandlerCfg config = (JMXConnectionHandlerCfg) configuration;
 
-    // Attempt to bind to the listen port to verify whether the connection
-    // handler will be able to start.
-    try
-    {
-      if (StaticUtils.isAddressInUse(
-        new InetSocketAddress(config.getListenPort()).getAddress(),
-        config.getListenPort(), true)) {
-        throw new IOException(
-          ERR_CONNHANDLER_ADDRESS_INUSE.get().toString());
+    if ((currentConfig == null) ||
+        (!currentConfig.isEnabled() && config.isEnabled()) ||
+        (currentConfig.getListenPort() != config.getListenPort())) {
+      // Attempt to bind to the listen port to verify whether the connection
+      // handler will be able to start.
+      try {
+        if (StaticUtils.isAddressInUse(
+          new InetSocketAddress(config.getListenPort()).getAddress(),
+          config.getListenPort(), true)) {
+          throw new IOException(
+            ERR_CONNHANDLER_ADDRESS_INUSE.get().toString());
+        }
+      } catch (Exception e) {
+        Message message = ERR_JMX_CONNHANDLER_CANNOT_BIND.get(
+          String.valueOf(config.dn()), config.getListenPort(),
+          getExceptionMessage(e));
+        unacceptableReasons.add(message);
+        return false;
       }
     }
-    catch (Exception e)
-    {
-      Message message = ERR_JMX_CONNHANDLER_CANNOT_BIND.
-          get(String.valueOf(config.dn()), config.getListenPort(),
-              getExceptionMessage(e));
-      unacceptableReasons.add(message);
-      return false;
-    }
 
     return isConfigurationChangeAcceptable(config, unacceptableReasons);
   }

--
Gitblit v1.10.0