From 96eaa516a85e620a6b76a64ffbe71cdc6037e026 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Wed, 13 Apr 2011 16:23:40 +0000
Subject: [PATCH] Initial fix for OpenDJ-97: Very many minor problems with the error logging for replication
---
opends/src/server/org/opends/server/replication/service/HeartbeatMonitor.java | 44 ++++++++++++++++++++++++++++++++++----------
1 files changed, 34 insertions(+), 10 deletions(-)
diff --git a/opends/src/server/org/opends/server/replication/protocol/HeartbeatMonitor.java b/opends/src/server/org/opends/server/replication/service/HeartbeatMonitor.java
similarity index 72%
rename from opends/src/server/org/opends/server/replication/protocol/HeartbeatMonitor.java
rename to opends/src/server/org/opends/server/replication/service/HeartbeatMonitor.java
index 854a7b2..d2325c8 100644
--- a/opends/src/server/org/opends/server/replication/protocol/HeartbeatMonitor.java
+++ b/opends/src/server/org/opends/server/replication/service/HeartbeatMonitor.java
@@ -26,7 +26,7 @@
* Portions Copyright 2011 ForgeRock AS
*/
-package org.opends.server.replication.protocol;
+package org.opends.server.replication.service;
import static org.opends.messages.ReplicationMessages.*;
import static org.opends.server.loggers.ErrorLogger.logError;
@@ -34,6 +34,7 @@
import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString;
import org.opends.server.loggers.debug.DebugTracer;
+import org.opends.server.replication.protocol.ProtocolSession;
import org.opends.server.api.DirectoryThread;
@@ -41,7 +42,7 @@
* This class implements a thread to monitor heartbeat messages from the
* replication server. Each broker runs one of these threads.
*/
-public class HeartbeatMonitor extends DirectoryThread
+final class HeartbeatMonitor extends DirectoryThread
{
/**
* The tracer object for the debug logger.
@@ -62,23 +63,44 @@
*/
private final long heartbeatInterval;
+ // Info required for logging.
+ private final int serverID;
+ private final int replicationServerID;
+ private final String baseDN;
+
/**
* Set this to stop the thread.
*/
private volatile boolean shutdown = false;
+
+
/**
* Create a heartbeat monitor thread.
- * @param threadName The name of the heartbeat thread.
- * @param session The session on which heartbeats are to be monitored.
- * @param heartbeatInterval The expected interval between heartbeats received
- * (in milliseconds).
+ *
+ * @param serverID
+ * The local directory server ID.
+ * @param replicationServerID
+ * The remote replication server ID.
+ * @param baseDN
+ * The name of the domain being replicated.
+ * @param session
+ * The session on which heartbeats are to be monitored.
+ * @param heartbeatInterval
+ * The expected interval between heartbeats received (in
+ * milliseconds).
*/
- public HeartbeatMonitor(String threadName, ProtocolSession session,
- long heartbeatInterval)
+ HeartbeatMonitor(int serverID, int replicationServerID,
+ String baseDN, ProtocolSession session, long heartbeatInterval)
{
- super(threadName);
+ super("Replica DS("
+ + serverID + ") heartbeat monitor for domain \""
+ + baseDN + "\" from RS(" + replicationServerID
+ + ") at " + session.getReadableRemoteAddress());
+ this.serverID = serverID;
+ this.replicationServerID = replicationServerID;
+ this.baseDN = baseDN;
this.session = session;
this.heartbeatInterval = heartbeatInterval;
}
@@ -114,7 +136,9 @@
if (gotOneFailure == true)
{
// Heartbeat is well overdue so the server is assumed to be dead.
- logError(NOTE_HEARTBEAT_FAILURE.get(currentThread().getName()));
+ logError(WARN_HEARTBEAT_FAILURE.get(serverID,
+ replicationServerID,
+ session.getReadableRemoteAddress(), baseDN));
session.close();
break;
}
--
Gitblit v1.10.0