|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.newisys.eventsim.SimulationManager
public class SimulationManager
Manages the creation, scheduling, and synchronization of serialized simulation threads.
| Constructor Summary | |
|---|---|
SimulationManager()
Constructs a new simulation manager with the default name, random factory, and seed source. |
|
SimulationManager(String name,
PRNGFactory defRandomFactory)
Constructs a new simulation manager with the given name and random factory, and a seed source created from the given factory with seed 0. |
|
SimulationManager(String name,
PRNGFactory defRandomFactory,
PRNG seedSource)
Constructs a new simulation manager with the given name, random factory, and seed source. |
|
| Method Summary | |
|---|---|
void |
executeThreads()
Executes runnable threads until none remain (i.e. |
SimulationThread[] |
fork(Runnable... rs)
Starts a set of new simulation threads with generated names. |
SimulationThread |
fork(Runnable r)
Starts a new simulation thread with a generated name. |
SimulationThread |
fork(String name,
Runnable r)
Starts a new simulation thread with the specified name. |
Thread |
getManagerThread()
Returns the thread used to schedule execution of simulation threads managed by this object. |
com.newisys.threadmarshal.ThreadMarshaller |
getThreadMarshaller()
Returns the thread marshaller used to allow simulation threads to execute calls from the scheduler thread. |
boolean |
hasActiveThreads()
Returns whether this object is currently managing any unterminated threads. |
void |
notifyOf(Event e)
Notifies waiting threads that an event has occurred. |
void |
terminateThreads()
Terminates all threads currently registered in the simulation. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public SimulationManager()
public SimulationManager(String name,
PRNGFactory defRandomFactory)
name - the name of this simulation manager (for debugging purposes)defRandomFactory - the factory used to create random number
generators for top-level threads
public SimulationManager(String name,
PRNGFactory defRandomFactory,
PRNG seedSource)
name - the name of this simulation manager (for debugging purposes)defRandomFactory - the factory used to create random number
generators for top-level threadsseedSource - the random number generator used to seed top-level
random number generators| Method Detail |
|---|
public Thread getManagerThread()
public com.newisys.threadmarshal.ThreadMarshaller getThreadMarshaller()
public final boolean hasActiveThreads()
This method must not be called from a managed simulation thread.
public void executeThreads()
throws UnhandledExceptionException
This method must be called from the thread that created this simulation manager.
UnhandledExceptionException - if a simulation thread is terminated
by an unhandled exceptionpublic final void terminateThreads()
This method may be called from both managed simulation threads and external threads.
public final SimulationThread fork(String name,
Runnable r)
This method may be called from both managed simulation threads and external threads.
name - the name of this thread, for debugging purposesr - the code to run for this thread
public final SimulationThread fork(Runnable r)
r - the code to run for this thread
public final SimulationThread[] fork(Runnable... rs)
rs - the code to run for each thread
public final void notifyOf(Event e)
This method may be called from both managed simulation threads and external threads.
e - the event to notify ofpublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||