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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classInner thread used to pollNested classes/interfaces inherited from class Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
Fields inherited from class Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new Dispatcher Thread -
Method Summary
Modifier and TypeMethodDescriptionvoidabortMeasure(int index) Aborts a measure, given its indexvoidvoidPauses current simulation only if it was already startedvoidRestarts current simulation, forcing abort of all measures, only if it was already startedvoidrun()Run method.voidstartSimulation(File simulationFile) This method starts simulation, given simulation XML filevoidStops current simulation, forcing abort of all measures, only if it was already startedMethods inherited from class Thread
activeCount, checkAccess, clone, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, threadId, toString, yieldMethods inherited from class Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface SimulationRunner
interrupt, isAlive, setDaemon
-
Constructor Details
-
DispatcherThread
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
-
startSimulation
This method starts simulation, given simulation XML file- Specified by:
startSimulationin interfaceSimulationRunner- 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:
stopSimulationin interfaceSimulationRunner
-
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:
abortMeasurein interfaceAbortMeasure- Parameters:
index- index of the measure to be aborted
-
notifyDetectedMalformedReplayerFile
- Specified by:
notifyDetectedMalformedReplayerFilein interfaceSimulationThread
-