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

Jean-Noel Rouvignac
03.34.2014 210d5f1b76962b2722db7b4d74c3372c22bcd0ca
opends/src/server/org/opends/server/replication/server/changelog/je/JEChangeNumberIndexDB.java
@@ -93,7 +93,6 @@
  private final AtomicLong lastGeneratedChangeNumber;
  private DbMonitorProvider dbMonitor = new DbMonitorProvider();
  private final AtomicBoolean shutdown = new AtomicBoolean(false);
  private volatile boolean trimDone = false;
  /**
   * A dedicated thread loops trim().
   * <p>
@@ -252,15 +251,15 @@
      notifyAll();
    }
    synchronized (this)
    { /* Can we just do a thread.join() ? */
      while (!trimDone)
    if (trimmingThread != null)
    {
      try
      {
        try
        {
          wait();
        } catch (InterruptedException e)
        { /* do nothing */ }
        trimmingThread.join();
      }
      catch (InterruptedException ignored)
      {
        // Nothing can be done about it, just proceed
      }
    }
@@ -283,12 +282,16 @@
        synchronized (this)
        {
          try
          if (!shutdown.get())
          {
            wait(1000);
          } catch (InterruptedException e)
          {
            Thread.currentThread().interrupt();
            try
            {
              wait(1000);
            }
            catch (InterruptedException e)
            {
              Thread.currentThread().interrupt();
            }
          }
        }
      }
@@ -302,35 +305,6 @@
        }
        break;
      }
      try {
        trim(shutdown);
        synchronized (this)
        {
          try
          {
            wait(1000);
          } catch (InterruptedException e)
          {
            Thread.currentThread().interrupt();
          }
        }
      } catch (Exception end)
      {
        logError(ERR_EXCEPTION_CHANGELOG_TRIM_FLUSH
            .get(stackTraceToSingleLineString(end)));
        if (replicationServer != null)
        {
          replicationServer.shutdown();
        }
        break;
      }
    }
    synchronized (this)
    {
      trimDone = true;
      notifyAll();
    }
  }