Package edu.rice.cs.util.newjvm

This package is a system to allow the invocation and control of a new Java virtual machine.

See:
          Description

Interface Summary
IntegratedMasterSlaveTest.TestMasterRemote  
IntegratedMasterSlaveTest.TestSlaveRemote  
MasterRemote The remote interface for a master JVM.
SlaveRemote The remote interface for a slave JVM.
 

Class Summary
AbstractMasterJVM An abstract class implementing the logic to invoke and control, via RMI, a second Java virtual machine.
AbstractSlaveJVM A partial implementation of a SlaveRemote that provides the quit functionality and that also periodically checks if the master is still alive and automatically quits if not.
ExecJVM A utility class to allow executing another JVM.
ExecJVMTest Test cases for ExecJVM.
ExecJVMTest.FileCreator  
ExecJVMTest.NoOp  
IntegratedMasterSlaveTest Test cases for the master/slave jvm control framework.
IntegratedMasterSlaveTest.CounterSlave The slave will exit with error codes in the case of problems, since there is no other thing it can do! 1MasterRemote class cast exception. 2Incorect value from getLetter 3RemoteException caught 4Timeout waiting for master JVM to call 5Interrupted while waiting for master JVM to call
SlaveJVMRunner This class is the root class for the Slave JVM.
 

Package edu.rice.cs.util.newjvm Description

This package is a system to allow the invocation and control of a new Java virtual machine. The two JVMs can communicate by using RMI.

To simply invoke a new JVM with no communications links, use the class ExecJVM. The rest of this page explains how to use this framework to create a new JVM and set up bidirectional communications using RMI. This system runs a second JVM using the same classpath as the current JVM (by invoking ExecJVM.runJVMPropagateClassPath(java.lang.String, java.lang.String[], java.lang.String[], java.io.File)).

  1. Create a remote interface that the master JVM will support, extending MasterRemote. This interface must specify of the methods that the slave JVM can call on the master JVM. All methods in this interface must be declared to throw RemoteException
  2. Create a remote interface that the slave JVM will support, extending SlaveRemote. This interface must specify of the methods that the master JVM can call on the slave JVM. All methods in this interface must be declared to throw RemoteException
  3. Create the master JVM implementation, which must extend AbstractMasterJVM and implement YourMasterInterface. Note that the super() call must pass to AbstractMasterJVM the fully-qualified class name of the slave JVM implementation.
  4. Create the slave JVM implementation, which must implement YourSlaveInterface. Don't forget to implement SlaveRemote.quit(), which is called when the main JVM requests the slave to quit, and SlaveRemote.start(edu.rice.cs.util.newjvm.MasterRemote), which is called when the slave JVM is started.

Now you can create an instance of your master JVM class and use its AbstractMasterJVM.invokeSlave() method to start the slave JVM.