From 042cb4492e64fed84141f94b0c969234465fc74d Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Wed, 14 Aug 2013 11:14:13 +0000
Subject: [PATCH] OPENDJ-1116 Introduce abstraction for the changelog DB
---
opendj-sdk/opends/src/server/org/opends/server/replication/server/MonitoringPublisher.java | 41 +++++++++++++++++------------------------
1 files changed, 17 insertions(+), 24 deletions(-)
diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/server/MonitoringPublisher.java b/opendj-sdk/opends/src/server/org/opends/server/replication/server/MonitoringPublisher.java
index 0f10959..eb678b0 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/server/MonitoringPublisher.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/server/MonitoringPublisher.java
@@ -28,13 +28,13 @@
package org.opends.server.replication.server;
import java.io.IOException;
-import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
-import static org.opends.server.loggers.debug.DebugLogger.getTracer;
import org.opends.server.api.DirectoryThread;
import org.opends.server.loggers.debug.DebugTracer;
import org.opends.server.replication.protocol.MonitorMsg;
+import static org.opends.server.loggers.debug.DebugLogger.*;
+
/**
* This thread regularly publishes monitoring information:
* - it sends monitoring messages regarding the direct topology (directly
@@ -54,13 +54,13 @@
*/
private static final DebugTracer TRACER = getTracer();
- // The domain we send monitoring for
+ /** The domain we send monitoring for. */
private final ReplicationServerDomain replicationServerDomain;
- // Sleep time (in ms) before sending new monitoring messages.
+ /** Sleep time (in ms) before sending new monitoring messages. */
private volatile long period;
- // Is the thread terminated ?
+ /** Whether the thread is terminated. */
private volatile boolean done = false;
private final Object shutdownLock = new Object();
@@ -75,8 +75,8 @@
long period)
{
super("Replication server RS("
- + replicationServerDomain.getReplicationServer()
- .getServerId() + ") monitor publisher for domain \""
+ + replicationServerDomain.getLocalRSServerId()
+ + ") monitor publisher for domain \""
+ replicationServerDomain.getBaseDn() + "\"");
this.replicationServerDomain = replicationServerDomain;
@@ -114,8 +114,7 @@
MonitorMsg monitorMsg = replicationServerDomain
.createGlobalTopologyMonitorMsg(0, 0, monitorData);
- int localServerId = replicationServerDomain
- .getReplicationServer().getServerId();
+ int localServerId = replicationServerDomain.getLocalRSServerId();
for (ServerHandler serverHandler : replicationServerDomain
.getConnectedDSs().values())
{
@@ -137,20 +136,14 @@
{
TRACER.debugInfo("Monitoring publisher for dn "
+ replicationServerDomain.getBaseDn()
- + " in RS "
- + replicationServerDomain.getReplicationServer()
- .getServerId()
+ + " in RS " + replicationServerDomain.getLocalRSServerId()
+ " has been interrupted while sleeping.");
-
}
done = true;
TRACER.debugInfo("Monitoring publisher for dn "
- + replicationServerDomain.getBaseDn()
- + " is terminated."
- + " This is in RS "
- + replicationServerDomain.getReplicationServer()
- .getServerId());
+ + replicationServerDomain.getBaseDn() + " is terminated."
+ + " This is in RS " + replicationServerDomain.getLocalRSServerId());
}
@@ -167,9 +160,9 @@
if (debugEnabled())
{
- TRACER.debugInfo("Shutting down monitoring publisher for dn " +
- replicationServerDomain.getBaseDn() + " in RS " +
- replicationServerDomain.getReplicationServer().getServerId());
+ TRACER.debugInfo("Shutting down monitoring publisher for dn "
+ + replicationServerDomain.getBaseDn()
+ + " in RS " + replicationServerDomain.getLocalRSServerId());
}
}
}
@@ -184,7 +177,7 @@
{
int FACTOR = 40; // Wait for 2 seconds before interrupting the thread
int n = 0;
- while ((!done) && (this.isAlive()))
+ while (!done && isAlive())
{
Thread.sleep(50);
n++;
@@ -192,8 +185,8 @@
{
TRACER.debugInfo("Interrupting monitoring publisher for dn " +
replicationServerDomain.getBaseDn() + " in RS " +
- replicationServerDomain.getReplicationServer().getServerId());
- this.interrupt();
+ replicationServerDomain.getLocalRSServerId());
+ interrupt();
}
}
} catch (InterruptedException e)
--
Gitblit v1.10.0