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

neil_a_wilson
01.30.2006 f8694ed7365096addbb23f82e0bf492fa87d2964
Make some minor changes to the server that will aid in setting up the test
environment. The following changes are included:

- Allow the server root to be set using a Java property instead of an
environment variable. Under most circumstances, an environment variable will
be used, but the system property may be used to override that.

- Create a system property that will cause all DirectoryThread objects to be
created as daemon threads. This can be called when running test cases so
that if the server needs to be started it will stop running when all the
tests are complete.
3 files modified
50 ■■■■■ changed files
opendj-sdk/opends/src/server/org/opends/server/api/DirectoryThread.java 19 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/config/ConfigFileHandler.java 12 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/util/ServerConstants.java 19 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/api/DirectoryThread.java
@@ -32,6 +32,8 @@
import org.opends.server.core.DirectoryServer;
import static org.opends.server.loggers.Debug.*;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
@@ -70,10 +72,11 @@
  // The task with which this thread is associated, if any.
  private Task task;
  // A reference to the thread that was used to create this thread.
  private Thread parentThread;
  /**
   * Creates a new instance of this directory thread with the
   * specified name and with the specified target as its run object.
@@ -147,8 +150,22 @@
    {
      task = null;
    }
    String forceDaemonStr =
         System.getProperty(PROPERTY_FORCE_DAEMON_THREADS);
    if (forceDaemonStr != null)
    {
      String lowerStr = toLowerCase(forceDaemonStr);
      if (lowerStr.equals("true") || lowerStr.equals("yes") ||
          lowerStr.equals("on") || lowerStr.equals("1"))
      {
        setDaemon(true);
      }
    }
  }
  /**
   * Retrieves the stack trace that was captured at the time that this
   * thread was created.
opendj-sdk/opends/src/server/org/opends/server/config/ConfigFileHandler.java
@@ -500,9 +500,15 @@
    // Determine the appropriate server root for the Directory Server.  First,
    // do this by looking at an environment variable.  If that isn't specified,
    // then try to figure it out from the location of the configuration file.
    String rootDirStr = System.getenv(ENV_VAR_INSTANCE_ROOT);
    // do this by looking for a Java property.  If that isn't specified, then
    // look for an environment variable, and if all else fails then try to
    // figure it out from the location of the configuration file.
    String rootDirStr = System.getProperty(PROPERTY_SERVER_ROOT);
    if (rootDirStr == null)
    {
      rootDirStr = System.getenv(ENV_VAR_INSTANCE_ROOT);
    }
    if (rootDirStr != null)
    {
      try
opendj-sdk/opends/src/server/org/opends/server/util/ServerConstants.java
@@ -2005,5 +2005,24 @@
   */
  public static final String PROPERTY_DISABLE_EXEC =
       "org.opends.server.DisableExec";
  /**
   * The name of the system property that can be used to determine whether all
   * <CODE>DirectoryThread</CODE> instances should be created as daemon threads
   * regardless of whether they would otherwise be configured that way.
   */
  public static final String PROPERTY_FORCE_DAEMON_THREADS =
       "org.opends.server.ForceDaemonThreads";
  /**
   * The name of the system property that can be used to specify the path to the
   * server root.
   */
  public static final String PROPERTY_SERVER_ROOT =
       "org.opends.server.ServerRoot";
}