|
SSJ V. 2.6.2. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object umontreal.iro.lecuyer.simevents.Simulator umontreal.iro.lecuyer.simprocs.ProcessSimulator
public abstract class ProcessSimulator
Defines a special type of simulator capable of managing processes.
This class extends the Simulator
class
with methods providing basic facilities used by process simulators
to suspend, resume, and kill processes.
It also specifies a mechanism for creating control events used for process synchronization.
These methods are not called directly by the user, but they
need to be implemented by any framework managing processes.
A process simulator is usually constructed by the newInstance
method which
selects the appropriate implementation based on system properties.
It can also be constructed manually by calling the appropriate constructor explicitly.
A default, implicit, simulator can also be used for compatibility with older programs.
This can be done by calling the initDefault
method or setting the
ssj.processes property.
Field Summary |
---|
Fields inherited from class umontreal.iro.lecuyer.simevents.Simulator |
---|
defaultSimulator |
Constructor Summary | |
---|---|
ProcessSimulator()
|
Method Summary | |
---|---|
abstract Event |
createControlEvent(SimProcess process)
Constructs and returns a new Event object used for synchronization. |
SimProcess |
currentProcess()
Returns the currently active process for this simulator. |
abstract void |
delay(SimProcess process,
double delay)
Suspends the execution of process and schedules it to resume its execution in delay units of simulation time. |
static void |
initDefault()
Initializes the default simulator to use processes. |
abstract void |
kill(SimProcess process)
Terminates the life of process and sets its state to DEAD, after canceling its control event if there is one. |
abstract void |
killAll()
Kills all currently living (active, delayed, or suspended) processes managed by this simulator. |
static ProcessSimulator |
newInstance()
Constructs and returns a new process-oriented simulator. |
abstract void |
suspend(SimProcess process)
Suspends process. |
Methods inherited from class umontreal.iro.lecuyer.simevents.Simulator |
---|
continuousState, getDefaultSimulator, getEventList, init, init, isSimulating, isStopped, start, stop, time |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ProcessSimulator()
Method Detail |
---|
public SimProcess currentProcess()
public abstract Event createControlEvent(SimProcess process)
Event
object used for synchronization.
Such control events are used by process simulator to start a process or to resume it if it is already
started.
public abstract void delay(SimProcess process, double delay)
process
- SimProcess variable to delay.delay
- delay value, in simulation time units.public abstract void suspend(SimProcess process)
process
- SimProcess variable to suspend.public abstract void kill(SimProcess process)
public abstract void killAll()
public static void initDefault()
newInstance
.
Warning: this method must be called before any event or process is
constructed, otherwise the program could return some exceptions like
ClassCastException
or NullPointerException
.
Alternatively, one can set the ssj.processes system property, which
instructs this class to call this method at the time it is loaded.
The aim of this method is to allow the user to use default process-oriented
simulation without giving options to the Java Virtual Machine.
See package
simevents and class Simulator
for more information about the default simulator.
public static ProcessSimulator newInstance()
ThreadProcessSimulator
.
Otherwise, if the ssj.withDSOL system property is set, this
returns a DSOLProcessSimulator
instance.
If no system property is set, this returns a ThreadProcessSimulator
.
For example, if a program is called using java -Dssj.withDSOL ..., it will use DSOL for process simulation.
|
SSJ V. 2.6.2. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |