From 9f0dae3d08ca0cf7c131af2f1fc09670ace301fa Mon Sep 17 00:00:00 2001
From: gbellato <gbellato@localhost>
Date: Thu, 13 Mar 2008 14:26:23 +0000
Subject: [PATCH] Fix for 3052 : IllegalMonitorStateException in replication HeartbeatThread

---
 opends/src/server/org/opends/server/replication/protocol/HeartbeatThread.java |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/protocol/HeartbeatThread.java b/opends/src/server/org/opends/server/replication/protocol/HeartbeatThread.java
index ef6b6aa..8341a6e 100644
--- a/opends/src/server/org/opends/server/replication/protocol/HeartbeatThread.java
+++ b/opends/src/server/org/opends/server/replication/protocol/HeartbeatThread.java
@@ -68,6 +68,7 @@
    * Set this to stop the thread.
    */
   private Boolean shutdown = false;
+  private final Object shutdown_lock = new Object();
 
 
   /**
@@ -135,11 +136,11 @@
             TRACER.debugVerbose("Heartbeat thread sleeping for %d", sleepTime);
           }
 
-          synchronized (shutdown)
+          synchronized (shutdown_lock)
           {
             if (!shutdown)
             {
-              shutdown.wait(sleepTime);
+              shutdown_lock.wait(sleepTime);
             }
           }
         }
@@ -173,10 +174,10 @@
    */
   public void shutdown()
   {
-    synchronized (shutdown)
+    synchronized (shutdown_lock)
     {
-      shutdown.notifyAll();
       shutdown = true;
+      shutdown_lock.notifyAll();
       if (debugEnabled())
       {
         TRACER.debugInfo("Going to notify Heartbeat thread.");

--
Gitblit v1.10.0