From d7e652c1013c88be63967d2c849bd066f38cdd0c Mon Sep 17 00:00:00 2001
From: Valery Kharseko <vharseko@3a-systems.ru>
Date: Mon, 06 Oct 2025 01:12:27 +0000
Subject: [PATCH] Fix unavailable monitoring attributes over JMX (#558)
---
opendj-server-legacy/src/main/java/org/opends/server/replication/service/ReplicationBroker.java | 23 ++++++++++++++++++++---
1 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/service/ReplicationBroker.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/service/ReplicationBroker.java
index 9ba8932..6e6504b 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/service/ReplicationBroker.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/service/ReplicationBroker.java
@@ -13,6 +13,7 @@
*
* Copyright 2006-2010 Sun Microsystems, Inc.
* Portions Copyright 2011-2016 ForgeRock AS.
+ * Portions Copyright 2025 Wren Security.
*/
package org.opends.server.replication.service;
@@ -3251,14 +3252,30 @@
return monitor.getMonitorInstanceName();
}
+ /**
+ * Updates the currently connected replication server reference.
+ * <p>
+ * If the new replication server differs from the previous one, this method will:
+ * <ul>
+ * <li>deregister the replication monitor associated with the old server,
+ * <li>close the old replication session,
+ * <li>and register a replication monitor for the new server.
+ *
+ * @param newRS The new {@link ConnectedRS} instance to set as the currently connected replication server.
+ * @return The newly set {@link ConnectedRS} instance.
+ */
private ConnectedRS setConnectedRS(final ConnectedRS newRS)
{
- final ConnectedRS oldRS = connectedRS.getAndSet(newRS);
- if (!oldRS.equals(newRS) && oldRS.isConnected())
+ ConnectedRS oldRS = connectedRS.get();
+ if (!oldRS.equals(newRS))
{
// monitor name is changing, deregister before registering again
deregisterReplicationMonitor();
- oldRS.session.close();
+ if (oldRS.isConnected())
+ {
+ oldRS.session.close();
+ }
+ connectedRS.set(newRS);
registerReplicationMonitor();
}
return newRS;
--
Gitblit v1.10.0