コード例 #1
0
  public void Close() {
    final String methodName = "Close";
    Logfile.WriteCalled(logLevel, STR_ClassName, methodName);

    try {
      if (this.labExperimentEngines == null) {
        throw new NullPointerException(STRERR_LabExperimentEngines);
      }

      /*
       * Check each experiment engine to see if it is running an experiment
       */
      for (int unitId = 0; unitId < this.labManagement.getFarmSize(); unitId++) {
        /*
         * Get the experiment engine
         */
        LabExperimentEngine labExperimentEngine = this.labExperimentEngines[unitId];
        if (labExperimentEngine == null) {
          throw new NullPointerException(
              String.format(STRERR_LabExperimentEngineUnitId_arg, unitId));
        }

        /*
         * Shutdown experiment engine
         */
        labExperimentEngine.Close();
      }
    } catch (Exception ex) {
      Logfile.WriteError(ex.toString());
    }

    /*
     * Shutdown experiment manager
     */
    if (this.running == true) {
      this.stopRunning = true;

      /*
       * Lab experiment manager thread may be waiting for an experiment submission signal
       */
      this.labManagement.getSignalSubmitted().Notify();

      /*
       * Wait for LabExperimentManager thread to terminate
       */
      try {
        this.thread.join();
      } catch (InterruptedException ex) {
        Logfile.WriteError(ex.toString());
      }
    }

    Logfile.WriteCompleted(logLevel, STR_ClassName, methodName);
  }