SSJ
V. 1.2.5.

umontreal.iro.lecuyer.simprocs
Class SimProcess

java.lang.Object
  extended by umontreal.iro.lecuyer.simprocs.AbstractSimProcess
      extended by umontreal.iro.lecuyer.simprocs.SimProcess

public abstract class SimProcess
extends AbstractSimProcess

Represents a simulation process with an associated Java thread. The simulation process threads are synchronized so only one process runs at a time.

Note: the user needs to ensure that the actions method of any process can be terminated, i.e., no infinite loops. If such a method never terminates, threads will not be recycled, causing memory problems.


Field Summary
 
Fields inherited from class umontreal.iro.lecuyer.simprocs.AbstractSimProcess
DEAD, DELAYED, EXECUTING, INITIAL, SUSPENDED
 
Constructor Summary
SimProcess()
          Constructs a new process without scheduling it.
 
Method Summary
 void delay(double delay)
          Suspends the execution of the currently executing process and schedules it to resume its execution in delay units of simulation time.
static void init()
          Initializes the process-driven simulation.
static void init(EventList evlist)
          Initializes the simulation and sets the given event list evlist to be used by the simulation executive.
 void kill()
          Terminates the life of this process and sets its state to DEAD, after canceling its activating event if there is one.
static void killAll()
          Kills all instances of the class SimProcess.
 void suspend()
          This method can only be invoked for the EXECUTING or a DELAYED process.
 
Methods inherited from class umontreal.iro.lecuyer.simprocs.AbstractSimProcess
actions, cancel, currentProcess, getDelay, getState, isAlive, reschedule, resume, schedule, scheduleNext
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimProcess

public SimProcess()
Constructs a new process without scheduling it. It will have to be scheduled later on. The process is in the INITIAL state.

Method Detail

init

public static void init()
Initializes the process-driven simulation. This kills all processes and calls Sim.init.


init

public static void init(EventList evlist)
Initializes the simulation and sets the given event list evlist to be used by the simulation executive.

Parameters:
evlist - selected event list implementation

delay

public void delay(double delay)
Description copied from class: AbstractSimProcess
Suspends the execution of the currently executing process and schedules it to resume its execution in delay units of simulation time. It becomes in the DELAYED state. Only the process in the EXECUTING state can call this method.

Specified by:
delay in class AbstractSimProcess
Parameters:
delay - delay, in simulation time, before the process is resumed

suspend

public void suspend()
Description copied from class: AbstractSimProcess
This method can only be invoked for the EXECUTING or a DELAYED process. If the process is EXECUTING, suspends execution. If the process is DELAYED, cancels its activating event. This places the process in the SUSPENDED state.

Specified by:
suspend in class AbstractSimProcess

kill

public void kill()
Description copied from class: AbstractSimProcess
Terminates the life of this process and sets its state to DEAD, after canceling its activating event if there is one.

Specified by:
kill in class AbstractSimProcess

killAll

public static void killAll()
Kills all instances of the class SimProcess.

Note: this method is unstable under Java versions 1.4 or greater.


SSJ
V. 1.2.5.

To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.