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

Matthew Swift
20.19.2012 e131e3cef7357a2f5acdc3d86979b8c5486ca71b
opends/src/server/org/opends/server/core/IdleTimeLimitThread.java
@@ -23,6 +23,7 @@
 *
 *
 *      Copyright 2008 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 */
package org.opends.server.core;
import org.opends.messages.Message;
@@ -38,6 +39,7 @@
import org.opends.server.types.DisconnectReason;
import static org.opends.server.loggers.debug.DebugLogger.*;
import org.opends.server.loggers.ErrorLogger;
import static org.opends.messages.CoreMessages.*;
@@ -60,8 +62,9 @@
  // Indicates whether a shutdown request has been received.
  private boolean shutdownRequested;
  // Shutdown monitor state.
  private volatile boolean shutdownRequested;
  private final Object shutdownLock = new Object();
@@ -93,10 +96,26 @@
    {
      try
      {
        try
        synchronized (shutdownLock)
        {
          sleep(sleepTime);
        } catch (InterruptedException ie) {}
          if (!shutdownRequested)
          {
            try
            {
              shutdownLock.wait(sleepTime);
            }
            catch (InterruptedException e)
            {
              // Server shutdown monitor may interrupt slow threads.
              if (debugEnabled())
              {
                TRACER.debugCaught(DebugLogLevel.ERROR, e);
              }
              shutdownRequested = true;
              break;
            }
          }
        }
        sleepTime = 5000L;
        for (ConnectionHandler<?> ch : DirectoryServer.getConnectionHandlers())
@@ -181,7 +200,11 @@
   */
  public void processServerShutdown(Message reason)
  {
    shutdownRequested = true;
    synchronized (shutdownLock)
    {
      shutdownRequested = true;
      shutdownLock.notifyAll();
    }
  }
}