From 9af5bd326500773d89ce30311af5e3cac2a9b3f5 Mon Sep 17 00:00:00 2001
From: Valery Kharseko <vharseko@3a-systems.ru>
Date: Tue, 29 Sep 2026 06:39:04 +0000
Subject: [PATCH] [#1112] Listen on the configured listen-address in the HTTP connection handler and the JMX RMI connector (#1113)

---
 opendj-server-legacy/src/main/java/org/opends/server/protocols/jmx/JmxConnectionHandler.java |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/protocols/jmx/JmxConnectionHandler.java b/opendj-server-legacy/src/main/java/org/opends/server/protocols/jmx/JmxConnectionHandler.java
index dbbb523..346024e 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/protocols/jmx/JmxConnectionHandler.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/protocols/jmx/JmxConnectionHandler.java
@@ -13,6 +13,7 @@
  *
  * Copyright 2006-2009 Sun Microsystems, Inc.
  * Portions Copyright 2013-2016 ForgeRock AS.
+ * Portions Copyright 2026 3A Systems, LLC.
  */
 package org.opends.server.protocols.jmx;
 
@@ -88,6 +89,14 @@
   private final List<HostPort> listeners = new LinkedList<>();
 
   /**
+   * The address the RMI registry and the RMI connector listen on. A change of
+   * listen-address takes effect when the handler restarts, as its
+   * configuration says: the registry, the connector and the listeners stay
+   * on the same address until then.
+   */
+  private InetAddress listenAddress;
+
+  /**
    * Creates a new instance of this JMX connection handler. It must be
    * initialized before it may be used.
    */
@@ -136,7 +145,7 @@
       }
 
       listeners.clear();
-      listeners.add(HostPort.allAddresses(config.getListenPort()));
+      listeners.add(new HostPort(listenAddress.getHostAddress(), config.getListenPort()));
 
       rmiConnector.finalizeConnectionHandler(portChanged);
       try
@@ -224,13 +233,14 @@
 
 
   /**
-   * Get the JMX connection handler's listen address.
+   * Get the JMX connection handler's listen address: the one it was
+   * initialized with, until it restarts.
    *
    * @return Returns the JMX connection handler's listen address.
    */
   public InetAddress getListenAddress()
   {
-    return currentConfig.getListenAddress();
+    return listenAddress;
   }
 
   /**
@@ -301,8 +311,9 @@
       protocol = "JMX";
     }
 
+    listenAddress = config.getListenAddress();
     listeners.clear();
-    listeners.add(HostPort.allAddresses(config.getListenPort()));
+    listeners.add(new HostPort(listenAddress.getHostAddress(), config.getListenPort()));
     connectionHandlerName = "JMX Connection Handler " + config.getListenPort();
 
     // Create a system property to store the JMX port the server is

--
Gitblit v1.10.0