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

Jean-Noël Rouvignac
10.11.2016 e877c67853fd9abae649ef36319da968b8523257
Always call Schema.setDefaultSchema() when schemaNG changes

DirectoryServer.java:
Made schema volatile
2 files modified
15 ■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java 11 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/types/Schema.java 4 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java
@@ -605,7 +605,7 @@
  private SASLConfigManager saslConfigManager;
  /** The schema for the Directory Server. */
  private Schema schema;
  private volatile Schema schema;
  /** The schema configuration manager for the Directory Server. */
  private SchemaConfigManager schemaConfigManager;
@@ -895,7 +895,7 @@
      // and register a minimal set of matching rules and attribute syntaxes.
      try
      {
        directoryServer.schema = new Schema(org.forgerock.opendj.ldap.schema.Schema.getCoreSchema());
        directoryServer.setSchema(new Schema(org.forgerock.opendj.ldap.schema.Schema.getCoreSchema()));
      }
      catch (DirectoryException unexpected)
      {
@@ -1593,7 +1593,7 @@
    // Create the schema configuration manager, and initialize the schema from
    // the configuration.
    schemaConfigManager = new SchemaConfigManager(serverContext);
    schema = schemaConfigManager.getSchema();
    setSchema(schemaConfigManager.getSchema());
    schemaConfigManager.initializeMatchingRules();
    schemaConfigManager.initializeAttributeSyntaxes();
@@ -2245,6 +2245,9 @@
  public static void setSchema(Schema schema)
  {
    directoryServer.schema = schema;
    org.forgerock.opendj.ldap.schema.Schema.setDefaultSchema(schema != null
        ? schema.getSchemaNG()
        : org.forgerock.opendj.ldap.schema.Schema.getCoreSchema());
  }
  /**
@@ -6224,7 +6227,7 @@
    if (schema != null)
    {
      schema.destroy();
      schema = null;
      setSchema(null);
    }
  }
opendj-server-legacy/src/main/java/org/opends/server/types/Schema.java
@@ -548,6 +548,10 @@
  private void setSchemaNG(org.forgerock.opendj.ldap.schema.Schema newSchemaNG)
  {
    schemaNG = newSchemaNG.asNonStrictSchema();
    if (DirectoryServer.getSchema() == this)
    {
      org.forgerock.opendj.ldap.schema.Schema.setDefaultSchema(schemaNG);
    }
  }
  private void updateSubordinateTypes(AttributeType attributeType)