From e131e3cef7357a2f5acdc3d86979b8c5486ca71b Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Tue, 20 Mar 2012 11:19:25 +0000
Subject: [PATCH] Fix OPENDJ-457: Sleeping replication threads prevent server from shutting down
---
opends/src/server/org/opends/server/replication/server/StatusAnalyzer.java | 25 +++++++++++++++----------
1 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/opends/src/server/org/opends/server/replication/server/StatusAnalyzer.java b/opends/src/server/org/opends/server/replication/server/StatusAnalyzer.java
index 05d97d0..e2e5b28 100644
--- a/opends/src/server/org/opends/server/replication/server/StatusAnalyzer.java
+++ b/opends/src/server/org/opends/server/replication/server/StatusAnalyzer.java
@@ -23,7 +23,7 @@
*
*
* Copyright 2008-2009 Sun Microsystems, Inc.
- * Portions Copyright 2011 ForgeRock AS
+ * Portions Copyright 2011-2012 ForgeRock AS
*/
package org.opends.server.replication.server;
@@ -34,6 +34,7 @@
import org.opends.server.loggers.debug.DebugTracer;
import org.opends.server.replication.common.ServerStatus;
import org.opends.server.replication.common.StatusMachineEvent;
+import org.opends.server.types.DebugLogLevel;
/**
* This thread is in charge of periodically determining if the connected
@@ -100,21 +101,25 @@
boolean interrupted = false;
while (!shutdown && !interrupted)
{
- try
+ synchronized (shutdownLock)
{
- synchronized (shutdownLock)
+ if (!shutdown)
{
- if (!shutdown)
+ try
{
shutdownLock.wait(STATUS_ANALYZER_SLEEP_TIME);
}
+ catch (InterruptedException e)
+ {
+ // Server shutdown monitor may interrupt slow threads.
+ if (debugEnabled())
+ {
+ TRACER.debugCaught(DebugLogLevel.ERROR, e);
+ }
+ shutdown = true;
+ break;
+ }
}
- } catch (InterruptedException ex)
- {
- TRACER.debugInfo("Status analyzer for dn " +
- replicationServerDomain.getBaseDn().toString() + " in RS " +
- replicationServerDomain.getReplicationServer().getServerId() +
- " has been interrupted while sleeping.");
}
// Go through each connected DS, get the number of pending changes we have
--
Gitblit v1.10.0