Class DispatcherThread

java.lang.Object
java.lang.Thread
common.controller.DispatcherThread
All Implemented Interfaces:
SimulationRunner, AbortMeasure, Runnable, SimulationThread

public class DispatcherThread extends Thread implements AbortMeasure, SimulationThread, SimulationRunner

Title: Dispatcher Thread

Description: This thread is responsible for dispatching simulation. If simulation max time has been specified, an inner thread will be used to stop simulation after that time. We do not rely on engine method as it does not appear to work properly.

Author:
Bertoli Marco Date: 8-set-2005 Time: 11.40.46 Modified by Francesco D'Aquino 9/11/2005
  • Constructor Details

    • DispatcherThread

      public DispatcherThread(GuiInterface gui, SimulationDefinition sd)
      Construct a new Dispatcher Thread
      Parameters:
      gui - reference to current gui object (can be JSIMMain or Mediator)
      sd - Reference to Simulation Definition data structure
  • Method Details

    • run

      public void run()
      Run method. This method will simply start simulation, it is designed to be called only after startSimulation has been called.
      Specified by:
      run in interface Runnable
      Overrides:
      run in class Thread
    • startSimulation

      public void startSimulation(File simulationFile)
      This method starts simulation, given simulation XML file
      Specified by:
      startSimulation in interface SimulationRunner
      Parameters:
      simulationFile - file where simulation model is stored
    • pauseSimulation

      public void pauseSimulation()
      Pauses current simulation only if it was already started
    • stopSimulation

      public void stopSimulation()
      Stops current simulation, forcing abort of all measures, only if it was already started
      Specified by:
      stopSimulation in interface SimulationRunner
    • restartSimulation

      public void restartSimulation()
      Restarts current simulation, forcing abort of all measures, only if it was already started
    • abortMeasure

      public void abortMeasure(int index)
      Aborts a measure, given its index
      Specified by:
      abortMeasure in interface AbortMeasure
      Parameters:
      index - index of the measure to be aborted
    • notifyDetectedMalformedReplayerFile

      public void notifyDetectedMalformedReplayerFile(String msg)
      Specified by:
      notifyDetectedMalformedReplayerFile in interface SimulationThread