mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

gbellato
29.27.2007 a6be5db964ffa77a68b91966d99f6fa0b36b532e
opends/src/server/org/opends/server/replication/protocol/HeartbeatThread.java
@@ -29,6 +29,7 @@
import org.opends.server.api.DirectoryThread;
import static org.opends.server.loggers.debug.DebugLogger.*;
import org.opends.server.loggers.debug.DebugTracer;
import java.io.IOException;
@@ -66,7 +67,7 @@
  /**
   * Set this to stop the thread.
   */
  private boolean shutdown = false;
  private Boolean shutdown = false;
  /**
@@ -133,7 +134,14 @@
          {
            TRACER.debugVerbose("Heartbeat thread sleeping for %d", sleepTime);
          }
          Thread.sleep(sleepTime);
          synchronized (shutdown)
          {
            if (!shutdown)
            {
              shutdown.wait(sleepTime);
            }
          }
        }
        catch (InterruptedException e)
        {
@@ -161,10 +169,23 @@
  /**
   * Call this method to stop the thread.
   * This method is blocking until the thread has stopped.
   */
  public void shutdown()
  {
    shutdown = true;
    synchronized (shutdown)
    {
      shutdown.notifyAll();
      shutdown = true;
      if (debugEnabled())
      {
        TRACER.debugInfo("Going to notify Heartbeat thread.");
      }
    }
    if (debugEnabled())
    {
      TRACER.debugInfo("Returning from Heartbeat shutdown.");
    }
  }