From 4d0faf5b8ad46e978a72d35a8f736f83fb61fd2d Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Wed, 30 Mar 2011 19:21:16 +0000
Subject: [PATCH] Fix issue OpenDJ-96: Replication server monitor data computation takes too long / blocks rest of server when another RS is cannot be reached
---
opends/src/server/org/opends/server/replication/server/MonitoringPublisher.java | 91 ++++++++++++++++++++++-----------------------
1 files changed, 44 insertions(+), 47 deletions(-)
diff --git a/opends/src/server/org/opends/server/replication/server/MonitoringPublisher.java b/opends/src/server/org/opends/server/replication/server/MonitoringPublisher.java
index d806ab9..c669651 100644
--- a/opends/src/server/org/opends/server/replication/server/MonitoringPublisher.java
+++ b/opends/src/server/org/opends/server/replication/server/MonitoringPublisher.java
@@ -28,14 +28,8 @@
package org.opends.server.replication.server;
import java.io.IOException;
-import java.util.NoSuchElementException;
-import org.opends.messages.Category;
-import org.opends.messages.Message;
-import org.opends.messages.Severity;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import static org.opends.server.loggers.debug.DebugLogger.getTracer;
-import static org.opends.server.loggers.ErrorLogger.logError;
-import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString;
import org.opends.server.api.DirectoryThread;
import org.opends.server.loggers.debug.DebugTracer;
@@ -97,67 +91,70 @@
{
if (debugEnabled())
{
- TRACER.debugInfo("Monitoring publisher starting for dn " +
- replicationServerDomain.getBaseDn().toString());
+ TRACER.debugInfo("Monitoring publisher starting for dn "
+ + replicationServerDomain.getBaseDn().toString());
}
- while (!shutdown)
+ try
{
- try
+ while (!shutdown)
{
- try
+ synchronized (shutdownLock)
{
- synchronized (shutdownLock)
+ if (!shutdown)
{
- if (!shutdown)
- {
- shutdownLock.wait(period);
- }
+ shutdownLock.wait(period);
}
- } catch (InterruptedException ex)
- {
- TRACER.debugInfo("Monitoring publisher for dn " +
- replicationServerDomain.getBaseDn().toString() + " in RS " +
- replicationServerDomain.getReplicationServer().getServerId() +
- " has been interrupted while sleeping.");
}
// Send global topology information to peer DSs
- MonitorMsg monitorMsg =
- replicationServerDomain.createGlobalTopologyMonitorMsg(0, 0, true);
- int localServerId =
- replicationServerDomain.getReplicationServer().getServerId();
- if (monitorMsg != null)
+ MonitorData monitorData = replicationServerDomain
+ .computeDomainMonitorData();
+
+ MonitorMsg monitorMsg = replicationServerDomain
+ .createGlobalTopologyMonitorMsg(0, 0, monitorData);
+
+ int localServerId = replicationServerDomain
+ .getReplicationServer().getServerId();
+ for (ServerHandler serverHandler : replicationServerDomain
+ .getConnectedDSs().values())
{
- for (ServerHandler serverHandler :
- replicationServerDomain.getConnectedDSs().values())
+ // Set the right sender and destination ids
+ monitorMsg.setSenderID(localServerId);
+ monitorMsg.setDestination(serverHandler.getServerId());
+ try
{
- // Set the right sender and destination ids
- monitorMsg.setSenderID(localServerId);
- monitorMsg.setDestination(serverHandler.getServerId());
- try
- {
- serverHandler.send(monitorMsg);
- } catch (IOException e)
- {
- // Server is disconnecting ? Forget it
- }
+ serverHandler.send(monitorMsg);
+ }
+ catch (IOException e)
+ {
+ // Server is disconnecting ? Forget it
}
}
- } catch (NoSuchElementException e)
- {
- logError(Message.raw(Category.SYNC, Severity.SEVERE_ERROR,
- stackTraceToSingleLineString(e)));
}
}
+ catch (InterruptedException e)
+ {
+ TRACER.debugInfo("Monitoring publisher for dn "
+ + replicationServerDomain.getBaseDn().toString()
+ + " in RS "
+ + replicationServerDomain.getReplicationServer()
+ .getServerId()
+ + " has been interrupted while sleeping.");
+
+ }
done = true;
- TRACER.debugInfo("Monitoring publisher for dn " +
- replicationServerDomain.getBaseDn().toString() + " is terminated." +
- " This is in RS " +
- replicationServerDomain.getReplicationServer().getServerId());
+ TRACER.debugInfo("Monitoring publisher for dn "
+ + replicationServerDomain.getBaseDn().toString()
+ + " is terminated."
+ + " This is in RS "
+ + replicationServerDomain.getReplicationServer()
+ .getServerId());
}
+
+
/**
* Stops the thread.
*/
--
Gitblit v1.10.0