Distributed Simjava Tutorial
For a tutorial on Simjava, see the
tutorial in the Simjava documentation.
In addition to basic Simjava knowledge, the following steps are required to
distribute a Simjava application using the extended Simjava package.
- Establish a distributed architecture for the Simjava simulation,
assigning entities to the machines that will be used.
- The constructors for the simulation's entities must receive a reference
to the Sim_system. The reference must be passed to the
entity's superclass. The constructor must also throw the exception
java.rmi.RemoteException.
- All calls to remote objects must be wrapped with try-catch
blocks and must catch the exception java.rmi.RemoteException.
- Any user-defined object passed as data in Sim_event objects must
have a remote interface if remote access to the data is required.
- Create a "Master" program that:
- Instantiates an instance of the Sim_system class and binds it
in the RMI registry, "bootstrapping" the system. It is encouraged that
all other remote references be passed as arguments in or return values
from remote method calls.
- Inform the Sim_system how many entities are expected in the
simulation.
- Implements the Linker interface.
- Create a number of "slave" programs that:
- Instantiate the simulation entities and add them to the
Sim_system
- Invoke the method readyToRun for each simulation entity
See Example1 to further
illustrate the construction of a distributed Simjava simulation.