/**
   * Exec the server process, notify mProcessWaitForThread (so that it will notice when the process
   * dies) and enable the heartbeat thread.
   */
  protected void startExecution() {
    customStartup();

    if (mGeneration > 0 && mIsJavaServer) {
      try {
        prepare();
      } catch (Exception ex) {
        mLogger.severe("Improper configuration for server", ex);
        synchronized (this) {
          mDisabled = true;
          changeState(STATE_DISABLED);
        }
        return;
      }
    }

    try {
      String runSeparator =
          "-------------------- Generation " + (mGeneration + 1) + " --------------------";

      mLogger.finest(runSeparator);
      mLogger.finest(LogUtil.splitLine(mPrintableCommand));
      mProcess = Runtime.getRuntime().exec(mPrintableCommand);
      new GetPidThread("server." + getName() + ".getpid").start();
      mExecTime = System.currentTimeMillis();
      mGeneration++;
      updateServerStatus();

      mLogger.finer("Spawned process");

      if (isNativeLoggingUsed()) {
        mStderr.setStream(mProcess.getErrorStream());
        mStdout.setStream(mProcess.getInputStream());
      }

      // Wake up the thread that waits for a process to die
      synchronized (mProcessWaitForThread) {
        mProcessWaitForThread.notifyAll();
      }
    } catch (IOException ioe) {
      mLogger.severe("Failure in starting server; Generation : mGeneration", ioe);
      synchronized (this) {
        mDisabled = true;
        changeState(STATE_DISABLED);
      }
    }
  }
  /**
   * If param b is set to true, starts the necessary threads to monitor the process' stdout/stderr
   * and transfer the contents to a log file.
   */
  protected void setNativeLoggingUsed(boolean b) {
    if (b) {

      mServerStatus.setLogNative(shouldIndicateNativeLogging());

      FileHandler fileHandler = null;

      try {
        String logLocation = LogUtil.getLogLocation();

        int logFileSize = -1;
        try {
          logFileSize = DCPLib.getIntProperty("Logging.Servers." + mName + ".logFileSize");
        } catch (NoSuchProperty nsp) {
          logFileSize =
              DCPLib.getIntProperty(
                  "Logging.Defaults.logFileSize", CiscoLogger.DEFAULT_LOG_FILE_SIZE);
        }

        int logFileNumber = -1;

        try {
          logFileNumber = DCPLib.getIntProperty("Logging.Servers." + mName + ".logFileNumber");
        } catch (NoSuchProperty nsp) {
          logFileNumber =
              DCPLib.getIntProperty(
                  "Logging.Defaults.logFileNumber", CiscoLogger.DEFAULT_LOG_FILE_NUMBER);
        }

        if (LogUtil.getAppType().equals("unknown")) {
          fileHandler =
              new FileHandler(
                  logLocation + File.separator + getProcessNameForLog(),
                  logFileSize,
                  logFileNumber);
        } else {
          fileHandler =
              new FileHandler(
                  logLocation
                      + File.separator
                      + LogUtil.getAppType()
                      + "."
                      + LogUtil.getAppInst()
                      + "."
                      + getProcessNameForLog(),
                  logFileSize,
                  logFileNumber);
        }

        fileHandler.setFormatter(
            new java.util.logging.SimpleFormatter() {
              public synchronized String format(LogRecord record) {
                return formatMessage(record) + "\n";
              }
            });

      } catch (Exception ex) {
        mLogger.severe("Could not set up native handler for external process", ex);
      }

      mStdout = new ServerOutputThread(mName + ".stdout", mLogger, fileHandler);
      mStderr = new ServerOutputThread(mName + ".stderr", mLogger, fileHandler);

      // Get them running
      mStdout.start();
      mStderr.start();
    }

    mNativeLoggingUsed = b;
  }