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

dugan
11.59.2007 c9fe1b46e445eda8680ae9b00e1b96e96dc46066
Add finalizePlugin method to remove Referential Integrity change listener and stop background thread if needed.
1 files modified
32 ■■■■■ changed files
opends/src/server/org/opends/server/plugins/ReferentialIntegrityPlugin.java 32 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/plugins/ReferentialIntegrityPlugin.java
@@ -27,6 +27,7 @@
package org.opends.server.plugins;
import org.opends.server.admin.std.server.ReferentialIntegrityPluginCfg;
import org.opends.server.admin.std.server.PluginCfg;
import org.opends.server.admin.std.meta.PluginCfgDefn;
import org.opends.server.admin.server.ConfigurationChangeListener;
import org.opends.server.api.plugin.*;
@@ -198,14 +199,28 @@
    baseDNs = newConfiguredBaseDNs;
    attributeTypes = newAttributeTypes;
    long newInterval=newConfiguration.getReferentialIntegrityUpdateInterval();
    //If the interval has changed, process that change. The change might start
    //or stop the background processing thread.
    if(newInterval != interval)
    //If the plugin is enabled and the interval has changed, process that
    //change. The change might start or stop the background processing thread.
    if(newConfiguration.isEnabled() && newInterval != interval)
      processIntervalChange(newInterval, messages);
    currentConfiguration = newConfiguration;
    return new ConfigChangeResult(resultCode, adminActionRequired, messages);
  }
  /**
   * {@inheritDoc}
   */
  @Override()
  public boolean isConfigurationAcceptable(PluginCfg configuration,
                                           List<Message> unacceptableReasons)
  {
    ReferentialIntegrityPluginCfg cfg =
                       (ReferentialIntegrityPluginCfg) configuration;
    return isConfigurationChangeAcceptable(cfg, unacceptableReasons);
  }
  /**
   * {@inheritDoc}
   */
@@ -731,6 +746,17 @@
    return name;
  }
  /**
   * {@inheritDoc}
   */
  @Override()
  public final void finalizePlugin() {
    currentConfiguration.removeReferentialIntegrityChangeListener(this);
    if(interval > 0)
      processServerShutdown(null);
  }
  /**
   * Process a server shutdown. If the background thread is running it needs
   * to be interrupted so it can read the stop request variable and exit.