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

Nicolas Capponi
18.16.2014 dcf15ca5e81a513c9183e501430902c040271b15
OPENDJ-1487 CR-4580 Prevent opened cursors when cleaning the file-based changelog

Prevent race condition by proper synchronization in
FileChangeLogDB#shutdownDB() method
1 files modified
37 ■■■■ changed files
opends/src/server/org/opends/server/replication/server/changelog/file/FileChangelogDB.java 37 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/changelog/file/FileChangelogDB.java
@@ -373,6 +373,24 @@
      purger.initiateShutdown();
    }
    // wait for shutdown of the threads holding cursors
    try
    {
      if (indexer != null)
      {
        indexer.join();
      }
      if (purger != null)
      {
        purger.join();
      }
    }
    catch (InterruptedException e)
    {
      // do nothing: we are already shutting down
    }
    // now we can safely shutdown all DBs
    try
    {
      shutdownChangeNumberIndexDB();
@@ -381,7 +399,6 @@
    {
      firstException = e;
    }
    for (Iterator<ConcurrentMap<Integer, FileReplicaDB>> it =
        this.domainToReplicaDBs.values().iterator(); it.hasNext();)
    {
@@ -395,26 +412,8 @@
        }
      }
    }
    if (replicationEnv != null)
    {
      // wait for shutdown of the threads holding cursors
      try
      {
        if (indexer != null)
        {
          indexer.join();
        }
        if (purger != null)
        {
          purger.join();
        }
      }
      catch (InterruptedException e)
      {
        // do nothing: we are already shutting down
      }
      replicationEnv.shutdown();
    }