/**
  * Hook method called by the super-class if the server enters unexpected state. This method
  * destroys the server process and changes state to disabled.
  */
 protected void handleUnexpectedState(Boolean stateChanged) {
   if (mProcess != null) {
     try {
       mProcess.exitValue();
       // the process has already exitted, try to restart it
       changeState(STATE_START_DEPENDENCIES);
     } catch (IllegalThreadStateException itse) {
       // the process is still running, so kill it
       mProcess.destroy();
     }
   } else {
     setDisabled(true);
     changeState(STATE_DISABLED);
   }
 }
  /**
   * 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);
      }
    }
  }
  /** Stop this server hard. Destroy the server process. */
  protected void stopServerHard() {
    if (mProcess != null) {
      String propertyName = getPropertyPrefix() + ".shutdown.cmd";
      String shutdownCmd = DCPLib.getProperty(propertyName, null);
      if (shutdownCmd != null) {
        mLogger.finer(propertyName + " " + shutdownCmd);
        ExecuteShutdownCmdThread script = new ExecuteShutdownCmdThread(shutdownCmd);
        script.start();
      }

      mLogger.finer("Destroying server process using destory()");
      mProcess.destroy();
      mLogger.finer("Destroyed server process");
      mProcess = null;
      mPid = 0;
    }
  }