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

Fabio Pistolesi
23.55.2015 6669e6d8a40905f214d83c36ffade6811b41844b
OPENDJ-1727 CR-6350 db-cache-percent default values in persistit backend probably too aggressive

Follow-up tp r11944, passing serverContext as parameter instead of setting a field, hence removing setServerContext() and related field.

7 files modified
53 ■■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/server/api/Backend.java 13 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/RootDSEBackend.java 3 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/BackendImpl.java 3 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/persistit/PitBackend.java 6 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/BackendImpl.java 20 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/task/TaskBackend.java 3 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/BackendConfigManager.java 5 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/api/Backend.java
@@ -113,16 +113,6 @@
      new ConcurrentLinkedQueue<PersistentSearch>();
  /**
   * Temporarily sets up the server context for the first phase of add of a new configuration entry.
   * Needed for checking storage parameters before committing the change in configuration.
   *
   * @param context the server context for this instance
   */
  public void setServerContext(ServerContext context)
  {
  }
  /**
   * Configure this backend based on the information in the provided
   * configuration.
   *
@@ -149,13 +139,14 @@
   * @param  unacceptableReasons  A list that may be used to hold the
   *                              reasons that the provided
   *                              configuration is not acceptable.
   * @param serverContext         this Directory Server instance's server context
   *
   * @return  {@code true} if the provided configuration is acceptable
   *          for this backend, or {@code false} if not.
   */
  public boolean isConfigurationAcceptable(
                      C configuration,
                      List<LocalizableMessage> unacceptableReasons)
                      List<LocalizableMessage> unacceptableReasons, ServerContext serverContext)
  {
    // This default implementation does not perform any special
    // validation.  It should be overridden by backend implementations
opendj-server-legacy/src/main/java/org/opends/server/backends/RootDSEBackend.java
@@ -967,7 +967,8 @@
  /** {@inheritDoc} */
  @Override
  public boolean isConfigurationAcceptable(RootDSEBackendCfg config,
                                           List<LocalizableMessage> unacceptableReasons)
                                           List<LocalizableMessage> unacceptableReasons,
                                           ServerContext serverContext)
  {
    return isConfigurationChangeAcceptable(config, unacceptableReasons);
  }
opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/BackendImpl.java
@@ -954,7 +954,8 @@
  /** {@inheritDoc} */
  @Override
  public boolean isConfigurationAcceptable(LocalDBBackendCfg config,
                                           List<LocalizableMessage> unacceptableReasons)
                                           List<LocalizableMessage> unacceptableReasons,
                                           ServerContext serverContext)
  {
    return isConfigurationChangeAcceptable(config, unacceptableReasons);
  }
opendj-server-legacy/src/main/java/org/opends/server/backends/persistit/PitBackend.java
@@ -33,6 +33,7 @@
import org.opends.server.admin.std.server.PersistitBackendCfg;
import org.opends.server.backends.pluggable.BackendImpl;
import org.opends.server.backends.pluggable.spi.Storage;
import org.opends.server.core.ServerContext;
/**
 * Class defined in the configuration for this backend type.
@@ -40,13 +41,14 @@
public final class PitBackend extends BackendImpl<PersistitBackendCfg>
{
  @Override
  public boolean isConfigurationAcceptable(PersistitBackendCfg cfg, List<LocalizableMessage> unacceptableReasons)
  public boolean isConfigurationAcceptable(PersistitBackendCfg cfg, List<LocalizableMessage> unacceptableReasons,
      ServerContext serverContext)
  {
    return PersistItStorage.isConfigurationAcceptable(cfg, unacceptableReasons, serverContext);
  }
  @Override
  protected Storage configureStorage(PersistitBackendCfg cfg) throws ConfigException
  protected Storage configureStorage(PersistitBackendCfg cfg, ServerContext serverContext) throws ConfigException
  {
    return new PersistItStorage(cfg, serverContext);
  }
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/BackendImpl.java
@@ -95,9 +95,6 @@
      OID_SERVER_SIDE_SORT_REQUEST_CONTROL,
      OID_VLV_REQUEST_CONTROL));
  /** The server context for this directory server. */
  protected ServerContext serverContext;
  /**
   * Begin a Backend API method that accesses the database and returns the <code>EntryContainer</code> for
   * <code>entryDN</code>.
@@ -152,9 +149,8 @@
    Reject.ifNull(cfg);
    this.cfg = cfg;
    this.serverContext = serverContext;
    baseDNs = this.cfg.getBaseDN().toArray(new DN[0]);
    storage = new TracedStorage(configureStorage(cfg), cfg.getBackendId());
    storage = new TracedStorage(configureStorage(cfg, serverContext), cfg.getBackendId());
  }
  /** {@inheritDoc} */
@@ -796,22 +792,18 @@
   *
   * @param cfg
   *          the configuration object
   * @param serverContext
   *          this Directory Server intsance's server context
   * @return The storage engine to be used by this pluggable backend.
   * @throws ConfigException
   *           If there is an error in the configuration.
   */
  protected abstract Storage configureStorage(C cfg) throws ConfigException;
  protected abstract Storage configureStorage(C cfg, ServerContext serverContext) throws ConfigException;
  /** {@inheritDoc} */
  @Override
  public void setServerContext(ServerContext context)
  {
    this.serverContext = context;
  }
  /** {@inheritDoc} */
  @Override
  public boolean isConfigurationAcceptable(C config, List<LocalizableMessage> unacceptableReasons)
  public boolean isConfigurationAcceptable(C config, List<LocalizableMessage> unacceptableReasons,
      ServerContext serverContext)
  {
    return isConfigurationChangeAcceptable(config, unacceptableReasons);
  }
opendj-server-legacy/src/main/java/org/opends/server/backends/task/TaskBackend.java
@@ -1721,7 +1721,8 @@
  /** {@inheritDoc} */
  @Override
  public boolean isConfigurationAcceptable(TaskBackendCfg config,
                                           List<LocalizableMessage> unacceptableReasons)
                                           List<LocalizableMessage> unacceptableReasons,
                                           ServerContext serverContext)
  {
    return isConfigAcceptable(config, unacceptableReasons, null);
  }
opendj-server-legacy/src/main/java/org/opends/server/core/BackendConfigManager.java
@@ -374,7 +374,7 @@
      }
      Backend b = backendClass.newInstance();
      if (! b.isConfigurationAcceptable(configEntry, unacceptableReason))
      if (! b.isConfigurationAcceptable(configEntry, unacceptableReason, serverContext))
      {
        return false;
      }
@@ -715,8 +715,7 @@
      }
    }
    backend.setServerContext(serverContext);
    if (!backend.isConfigurationAcceptable(configEntry, unacceptableReason))
    if (!backend.isConfigurationAcceptable(configEntry, unacceptableReason, serverContext))
    {
      return false;
    }