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

abobrov
14.56.2007 b05ed82c390ac4d8ac800597ba37ffb5e1f39f1b
- [Issue 1771]  entry cache implementations should flush entries when backends go offline:
this fix makes entry cache registered with backend initialization listener and clears related
entries when their backend about to go offline.
2 files modified
51 ■■■■■ changed files
opends/src/server/org/opends/server/api/EntryCache.java 38 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/core/DirectoryServer.java 13 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/api/EntryCache.java
@@ -31,6 +31,7 @@
import java.util.List;
import java.util.concurrent.locks.Lock;
import org.opends.server.core.DirectoryServer;
import org.opends.server.config.ConfigException;
import org.opends.server.types.DN;
import org.opends.server.types.Entry;
@@ -72,8 +73,22 @@
 */
public abstract class EntryCache
       <T extends EntryCacheCfg>
       implements BackendInitializationListener
{
  /**
   * Default constructor which is implicitly called from all entry
   * cache implementations.
   */
  public EntryCache()
  {
    // Register with backend initialization listener to clear cache
    // entries belonging to given backend that about to go offline.
    DirectoryServer.registerBackendInitializationListener(this);
  }
  /**
   * The tracer object for the debug logger.
   */
  private static final DebugTracer TRACER = getTracer();
@@ -492,4 +507,27 @@
   * to avoid out of memory errors.
   */
  public abstract void handleLowMemory();
  /**
   * {@inheritDoc}
   */
  public void performBackendInitializationProcessing(Backend backend)
  {
    // Do nothing.
  }
  /**
   * {@inheritDoc}
   */
  public void performBackendFinalizationProcessing(Backend backend)
  {
    // Do not clear any backends if the server is shutting down.
    if ( !(DirectoryServer.getInstance().isShuttingDown()) ) {
      clearBackend(backend);
    }
  }
}
opends/src/server/org/opends/server/core/DirectoryServer.java
@@ -8587,6 +8587,19 @@
  }
  /**
   * Indicates whether the server is currently in the process of shutting down.
   * @return <CODE>true</CODE> if this server is currently in the process of
   * shutting down and <CODE>false</CODE> otherwise.
   */
  public boolean isShuttingDown()
  {
    return shuttingDown;
  }
  /**
   * Parses the provided command-line arguments and uses that information to
   * bootstrap and start the Directory Server.